I can never remember the number. I need a memory rule.
-
48unsigned: 2³²-1 = 4·1024³-1; signed: -2³¹ .. +2³¹-1, because the sign-bit is the highest bit. Just learn 2⁰=1 to 2¹⁰=1024 and combine. 1024=1k, 1024²=1M, 1024³=1G – comonad Mar 28 '11 at 20:01
-
31I generally remember that every 3 bits is about a decimal digit. This gets me to the right order of magnitude: 32 bits is 10 digits. – Barmar Oct 02 '13 at 15:11
-
8@JoachimSauer it can certainly help debugging if you learn to at least recognize these kinds of numbers. – Dunaril Nov 13 '13 at 16:38
-
72"if a disk becomes full, deleting all mbytes will archive" (2 letters, 1 letter, 4 letters, 7 letters, 4 letters, 8 letters, 3 letters, 6 letters, 4 letters, 7 letters) – UltraCommit Mar 11 '14 at 14:30
-
8A case, when the int32 is not enough: http://www.bbc.com/news/world-asia-30288542 – Balazs Nemeth Dec 04 '14 at 20:14
-
1Why on earth do you want to remember the exact number? What @JoachimSauer said is the way you do away with the number. – Sнаđошƒаӽ Mar 21 '15 at 10:55
-
@UltraCommit why do you think your way is any more *useful* than plain 2,147,483,647? – Sнаđошƒаӽ Mar 21 '15 at 10:57
-
5Again, "7 and seven 'f's" is an easy to remember mnemonic! (0x7fffffff) :) – ctpenrose May 07 '15 at 19:27
-
@Flinkman, file `limits.h` contains all that useful constants and much more. It would be more appropriate to ask about "where to find all that reference platform-specific values?". – Bulat M. Sep 14 '16 at 06:06
-
1best way to remember it is not to try but just bookmark some internet page where the number is written on (i. e. this one) – BlueWizard Oct 13 '16 at 12:50
-
2start with 2...7 days in a week, 2*7=14 that is 2147 now next two are 47+1=48, 214748, next is number of days in year - 1, 365-1=364 and end again with 7. You will now never be able to forget I guess :) 2 14 7 48 364 7 = 2 1 47 48 364 7 = 2147483647 – Jan 19 '17 at 09:37
-
Slightly less than the view count of Gangnam Style on Youtube – kynnysmatto Apr 15 '17 at 12:36
-
3this kind of question would be shamelessly trashed on today's SO. Especially anywhere near certain regions that shall not be named. – Chris May 12 '17 at 17:54
-
You can do `(1 << 31) -1` or `(1 << -1) -1` for signed 32-bit or `~0` for unsigned 32-bit. – Peter Lawrey Aug 30 '18 at 16:29
-
Just remember that it's the eighth Mersenne prime. That should help you remember the number. – Stephen Nov 01 '18 at 05:34
-
If you are 1337 h4x0r you will remember it with Piata: "Piata ate eg at" ... n00n? Let's say she ate that egg at noon. – G.Rassovsky Feb 11 '19 at 10:00
-
"If I have integer then possible max number isnt fifteen." Instead it's the concatenated lengths of those words. Cool stuff. – Rick Jun 18 '19 at 12:42
-
8[This post is being discussed on meta](https://meta.stackoverflow.com/q/387214/6296561) – Zoe Jul 15 '19 at 13:36
45 Answers
It's 2,147,483,647. Easiest way to memorize it is via a tattoo.

- 102,129
- 8
- 104
- 120
-
83My mnemonic: 2^10 is very near to 1000, so 2^(3*10) is 1000^3 or about 1 billion. One of the 32 bits is used for sign, so the max value is really only 2^31, which is about twice the amount you get for 2^(3*10): 2 billion. – 16807 Dec 03 '13 at 22:24
-
1@16807 there's used zero bits for sign (on most architectures at least) if there was a bit used for sign there'd be to zeros and the absolut value of the min and max number would be the same but it's not. there's one more negative number than there's positive numbers because the representation is most widely used is two's complement – Rune FS Oct 08 '14 at 05:29
-
1@RuneFS fair enough. What I mean to say is there's 32 bits but the extremes must be near 2^31. In any case, the mnemonic is only supposed to be accurate to the nearest billion. – 16807 Oct 08 '14 at 14:51
-
164
-
I did `2^32` and answer came out to be `4294967296`. I think the number you wrote is for signed max value(+ve)....I added `2,147,483,647 + 2,147,483,647` and the answer came out to be `4294967294`...Its 2 less than what I got with 2^32 any reasoning? @BenHoffstein – abhimanyuaryan Feb 07 '16 at 08:19
-
3@AbhimanyuAryan Imagine it as a zero-based array and take the formula `2^index = value`. `2^0 = 1`, `2^1 = 2`, `2^2 = 4` ... `2^32 = 4294967296` wait ... you only have 32 bits, that is index 0-31. To get max value you actually have to calculate the sum of `2^n` with n from 0 to 31 or simpler `2^32 - 1` and you'll get '4294967295' as max for unsigned int, one less than anticipated. Now do the same with `2^31 - 1` for signed int and you'll get `2,147,483,647`. Do that two times (one for negative and one for positive int) and there you'll get your discrepancy of 2 from `2*(2^31 - 1)` to `2^32` ;) – Otto Abnormalverbraucher Feb 24 '16 at 16:12
-
20
-
1272,147,483,647 = 0x7FFFFFFF, if you wanna remember it, just use hex. – roottraveller Aug 13 '16 at 06:18
-
3
-
3@roottraveller At that point, you might as well just remember it in binary; 01111111111111111111111111111111 – pretzlstyle Jan 10 '18 at 20:59
-
@roottraveller 01111111111111111111111111111111 is octal in most languages, 0b01111111111111111111111111111111 would be the correct Java version – osundblad Nov 20 '18 at 20:59
-
-
The most correct answer I can think of is Int32.MaxValue
.

- 12,449
- 5
- 36
- 42
-
18Before this existed, I used to #define INT32_MIN and INT32_MAX in all my projects. – WildJoe Sep 12 '11 at 19:04
-
3When you are programming: yes in 99% of cases. But you may want to know that it's something like ~ 2 billion to planning programming approaches or when working with data, although it's a very large number. :) – Andre Figueiredo Nov 17 '13 at 21:53
-
@sehe Isn't latin1/Windows 1252 obsolete by now? If it can't fit in the 7 bytes of ASCII, I don't think it deserves a place in main-memory. I mean... *all* UNICODE code-pages is kinda useful, but over a meg of skin-space seems a waste. (Not to mention it still doesn't include descriptive glyphs for "pageup/pagedown" or "pagehome/pageend") – May 28 '14 at 14:18
-
try that in python2. Actually don't; I will tell you that the built in `int` object does not have this. :( – dylnmc Nov 20 '14 at 16:48
-
1This property might be a good advice additionally to mentioning the correct number. However, I don't like this answer as it only mentions an unportable way of dertermining the value and it doesn't mention for which programming languages this is works, either... – mozzbozz Dec 12 '14 at 12:29
-
No offense, but can you print the value of `Int32.MaxValue` inside your head? ;-) The question asks for, though absurd, a way to remember the figure – Sнаđошƒаӽ Mar 21 '15 at 11:00
-
What language is this? I tried it in my Terminal (ShellScript), Python 3.6.4, and Python 2.7. It doesn't work in any of these! – aravk33 Mar 17 '18 at 08:47
-
@Cubetastic It is .Net Framework (any language really, but I normally code in C#). – Adrian Clark Mar 20 '18 at 03:57
-
If you think the value is too hard to remember in base 10, try base 2: 1111111111111111111111111111111

- 12,169
- 3
- 35
- 49
-
3
-
145@Nick Whaley: No, 1111111111111111111111111111111 is positive. 11111111111111111111111111111111 would be negative :-) – Curd Apr 19 '11 at 12:48
-
58
-
34@Curd `11111111111111111111111111111111` as a base-2 number would still be positive *(an example negative in base-2 would be `-1`)*. That sequence of bits is only negative if representing a 32-bit 2's complement number :) – BlueRaja - Danny Pflughoeft May 16 '14 at 13:35
-
143Easiest to remember will be base 2,147,483,647. Then all you have to remember is 1. – big_tommy_7bb Aug 18 '14 at 08:58
-
82
-
2@tim_barber_7BB then you would have to remember the base "2,147,483,647" , so we are back were we started, this might lead to stack over flow exception. – sharp12345 Oct 30 '14 at 02:18
-
1The dotted decimal of that is 127.255.255.255. Looks like mix of subnet mask and ip address. – dylnmc Nov 20 '14 at 16:59
-
7
-
2I like the way one can see at a glance that this is correct, especially if you have superpowers – PJTraill Jul 28 '15 at 21:15
-
1
if you can remember the entire Pi number, then the number you are looking for is at the position 1,867,996,680 till 1,867,996,689 of the decimal digits of Pi
The numeric string 2147483647 appears at the 1,867,996,680 decimal digit of Pi. 3.14......86181221809936452346214748364710527835665425671614...
source: http://www.subidiom.com/pi/

- 3,874
- 1
- 20
- 15
-
30you know, when i started reading your answer i was expecting something practical, like the 20th digit. – JqueryToAddNumbers Nov 16 '15 at 09:55
-
95This seems pretty cool. Do you have another memory rule to remember 1,867,996,680? I find it difficult to remember at which index to start looking.... – Alderath Jan 13 '16 at 08:35
-
10"*if you can remember the entire Pi number...*" - no, you can't, it is [*irrational*](https://en.wikipedia.org/wiki/Irrational_number) {as are possibly one or two posts in this Q&As} 8-D – SlySven Jun 24 '16 at 21:45
-
-
10@Alderath I typically remember it as the 10 decimals in sqrt(2) starting at digit number 380,630,713.... – htd Sep 06 '16 at 18:38
-
@SlySven Have to refer you Sнаđошƒаӽ's answer, where he recommends tattoos to aid memory. I love it. I don't think I'd mind seeing a tattoo with the value of pi on it :-) – WonderWorker Sep 13 '16 at 08:46
-
@Knickerless-Noggins maybe, but a numeric form would always be incomplete, though I suspect a geometric one would be relatively straightforward. Incidentally, according to [50 Interesting Facts About . . . Pi](http://facts.randomhistory.com/2009/07/03_pi.html) Fact 46: _Thirty-nine decimal places of pi suffice for computing the circumference of a circle girding the known universe with an error no greater than the radius of a hydrogen atom._ (apparently from: Pickover, Clifford A. ___Keys to Infinity___. Denver, CO: John Wiley & Sons, Inc.) So we don't need that many digits of π anyhow! – SlySven Sep 13 '16 at 23:56
-
1Very cool stuff!! You can even search for it using an int type number as index since 1,867,996,680 < 2,147,483,647 ! – Rui Santos Nov 10 '16 at 11:51
-
2@Alderath: The numeric string 1867996680 appears at the 380,630,713rd decimal digit of the Square Root of 2. – Yair Halberstadt Dec 14 '17 at 11:04
-
1And 380630713 appears at the 779,302,404th decimal digit of Pi and at the 862,984,621st decimal digit of E. Take your pick! – Justsalt Aug 28 '18 at 20:35
-
1@Justsalt: That sounds like a bug: it has messed up our loop variant, as now the index, which was going down so promisingly (2,147,483,647 > 1,867,996,680) has ballooned back up again: < 779,302,404. – PJTraill Dec 05 '18 at 12:31
It's 10 digits, so pretend it's a phone number (assuming you're in the US). 214-748-3647. I don't recommend calling it.

- 5,740
- 3
- 26
- 30
-
13Speaking of remembering it as a phone number, it seems that there may be some phone spammers using it: http://mrnumber.com/1-214-748-3647 – Steven Oct 22 '10 at 14:57
-
8"There is no "748" exchange in Dallas. This number is fake." - from the page linked by shambleh – Tarnay Kálmán Jan 21 '11 at 22:10
-
104@Steven I don't think they're spammers, just people who accidentally stored the phone number as an `INT` instead of `VARCHAR` in MySQL. – Zarel Feb 09 '11 at 02:00
-
8Tried calling it. It rang a few times then went to the error dial tone. =( – Krythic Feb 21 '16 at 03:52
Rather than think of it as one big number, try breaking it down and looking for associated ideas eg:
- 2 maximum snooker breaks (a maximum break is 147)
- 4 years (48 months)
- 3 years (36 months)
- 4 years (48 months)
The above applies to the biggest negative number; positive is that minus one.
Maybe the above breakdown will be no more memorable for you (it's hardly exciting is it!), but hopefully you can come up with some ideas that are!

- 32,786
- 3
- 30
- 57
-
99That is one of the most complicated mneumonic devices I have seen. Impressive. – Ben Hoffstein Sep 18 '08 at 17:34
-
9Heh, the likes of Derren Brown actually advocate this kind of approach - breaking a number down into something random but whieh is more memorable than just a load of numbers: http://www.channel4.com/entertainment/tv/microsites/M/mindcontrol/remember/memory.html – Luke Bennett Sep 18 '08 at 22:02
-
19I have a better mnemonic: all you need to remember are 2 and 31, as it is apparently exactly 2^31 ! Oh, wait... – Tamas Czinege Jun 17 '09 at 10:08
-
Now that I actually have been typing this in, I keep thinking of your mnemonic... It's rather useful! – Shotgun Ninja Aug 11 '11 at 13:45
-
28@DrJokepu I am not sure about the operator precedence... Does that mean `2^(31!)` or `(2^31)!`? – Alderath Mar 29 '12 at 10:27
-
Just note that you should not start this memory device from a [free ball situation](http://en.wikipedia.org/wiki/Maximum_break#Breaks_exceeding_147)... – sehe Feb 12 '13 at 09:31
-
-
1@Lucio Note that my answer relates in the first instance to the biggest negative number which ends in 48, not 47 – Luke Bennett May 21 '13 at 08:49
-
@LukeBennett according to http://www.belfasttelegraph.co.uk/news/alex-higgins/alex-higgins-a-155-break-impossible-not-for-higgy-28548775.html Higgins is said to be one of the few players in snooker history to have scored a break of 155 — rather remarkable as the 'maximum' is generally considered to be 147. But a 155 is possible, although it requires exceptional circumstances. – Diamantatos Paraskevas Jun 27 '17 at 09:16
Largest negative (32bit) value : -2147483648
(1 << 31)
Largest positive (32bit) value : 2147483647
~(1 << 31)
Mnemonic: "drunk AKA horny"
drunk ========= Drinking age is 21
AK ============ AK 47
A ============= 4 (A and 4 look the same)
horny ========= internet rule 34 (if it exists, there's 18+ material of it)
21 47 4(years) 3(years) 4(years)
21 47 48 36 48

- 41,901
- 18
- 127
- 145

- 2,068
- 1
- 14
- 7
-
27The worlds most difficult to recall Mnemonic. If you can memorise 0118 999 88199 9119 752...3 you can memorise this. – BenM Jan 20 '14 at 13:33
-
11
-
Ah damn it I did know this and sang it in my head before typing it, how the hell did I get those two mixed up. QQ – BenM Jan 27 '14 at 10:59
-
1
-
21Nope. Drinking age is 18 here... Seems like I can't use this mnemonic, my life is ruined. – Joffrey Jun 19 '14 at 18:17
-
4@Aaren Cordova They used to say stackoverflow will never be funny, be nothing more than a Q&A site, I generally point them to this answer. This thing can only be created inside a genius mind, I mean this *is* Art. – Mohd Abdul Mujib Jun 29 '15 at 21:16
-
5The largest negative 32 bit integer, or 64 bit for that matter, is -1. – Fred Mitchell Jun 21 '16 at 21:04
Anyway, take this regex (it determines if the string contains a non-negative Integer in decimal form that is also not greater than Int32.MaxValue)
[0-9]{1,9}|[0-1][0-9]{1,8}|20[0-9]{1,8}|21[0-3][0-9]{1,7}|214[0-6][0-9]{1,7}|2147[0-3][0-9]{1,6}|21474[0-7][0-9]{1,5}|214748[0-2][0-9]{1,4}|2147483[0-5][0-9]{1,3}|21474836[0-3][0-9]{1,2}|214748364[0-7]
Maybe it would help you to remember.
-
12That sounds a lot easier and fun to me. Actually it really is much easier than `2147483647`. This would be of great help for the OP – Sнаđошƒаӽ Mar 24 '15 at 17:45
That's how I remembered 2147483647
:
- 214 - because 2.14 is approximately pi-1
- 48 = 6*8
- 64 = 8*8
Write these horizontally:
214_48_64_
and insert:
^ ^ ^
7 3 7 - which is Boeing's airliner jet (thanks, sgorozco)
Now you've got 2147483647.
Hope this helps at least a bit.

- 1,037
- 8
- 14
-
3Nice one! I think the 214 rule should be pi - 1. Also the mask shows 68 rather than 64. =) For aviation buffs like me, the 737 value should be easy to remember associating it with Boeing's medium-sized airliner jet. – Sep 19 '13 at 19:51
-
You can go further than that. Drop the decimal and compare pi and 2^31-1. In the same positions you get 141 vs 147, so the last digit just becomes a 7. Then 592 vs 483, all are one digit off of each other. And 643 vs 647, it's that becoming a 7 thing again. – Peter Cooper Oct 10 '13 at 10:45
-
@PeterCooper Altho the decimals for pi starts with 1415926_5_35 (Note the 5, not a 4) – Moberg Feb 17 '14 at 22:27
-
15My mnemonic is to take 4294967296 (which is easy to remember) and divide by 2 – M.M Sep 05 '14 at 05:39
2^(x+y) = 2^x * 2^y
2^10 ~ 1,000
2^20 ~ 1,000,000
2^30 ~ 1,000,000,000
2^40 ~ 1,000,000,000,000
(etc.)
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64
2^7 = 128
2^8 = 256
2^9 = 512
So, 2^31 (signed int max) is 2^30 (about 1 billion) times 2^1 (2), or about 2 billion. And 2^32 is 2^30 * 2^2 or about 4 billion. This method of approximation is accurate enough even out to around 2^64 (where the error grows to about 15%).
If you need an exact answer then you should pull up a calculator.
Handy word-aligned capacity approximations:
- 2^16 ~= 64 thousand // uint16
- 2^32 ~= 4 billion // uint32, IPv4, unixtime
- 2^64 ~= 16 quintillion (aka 16 billion billions or 16 million trillions) // uint64, "bigint"
- 2^128 ~= 256 quintillion quintillion (aka 256 trillion trillion trillions) // IPv6, GUID

- 19,513
- 7
- 48
- 71
Just take any decent calculator and type in "7FFFFFFF" in hex mode, then switch to decimal.
2147483647.

- 4,284
- 3
- 36
- 44
-
150
-
17
-
2
-
4
-
8
-
1any calculator that supports hexadecimal would support bitwise operations as well, so simply type 0 and press `NOT` button – phuclv Nov 05 '15 at 16:45
It's about 2.1 * 10^9
. No need to know the exact 2^{31} - 1 = 2,147,483,647
.
C
You can find it in C like that:
#include <stdio.h>
#include <limits.h>
main() {
printf("max int:\t\t%i\n", INT_MAX);
printf("max unsigned int:\t%u\n", UINT_MAX);
}
gives (well, without the ,
)
max int: 2,147,483,647
max unsigned int: 4,294,967,295
C++ 11
std::cout << std::numeric_limits<int>::max() << "\n";
std::cout << std::numeric_limits<unsigned int>::max() << "\n";
Java
You can get this with Java, too:
System.out.println(Integer.MAX_VALUE);
But keep in mind that Java integers are always signed.
Python 2
Python has arbitrary precision integers. But in Python 2, they are mapped to C integers. So you can do this:
import sys
sys.maxint
>>> 2147483647
sys.maxint + 1
>>> 2147483648L
So Python switches to long
when the integer gets bigger than 2^31 -1

- 124,992
- 159
- 614
- 958
-
The Python answer is outdated see: https://stackoverflow.com/questions/13795758/what-is-sys-maxint-in-python-3 – NOhs Jun 10 '18 at 15:14
-
@NOhs I appreciate the link, but my Python answer is about "Python 2" (I add the 2 to the section title to make it more clear). So my answer is not outdated. (But Python 2, admittedly, is) – Martin Thoma Jun 10 '18 at 16:03
Here's a mnemonic for remembering 2**31, subtract one to get the maximum integer value.
a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9
Boys And Dogs Go Duck Hunting, Come Friday Ducks Hide
2 1 4 7 4 8 3 6 4 8
I've used the powers of two up to 18 often enough to remember them, but even I haven't bothered memorizing 2**31. It's too easy to calculate as needed or use a constant, or estimate as 2G.

- 299,747
- 42
- 398
- 622
-
3What do you do for 2^10, 2^11, 2^12, or 2^17 (all of which have zeroes)? – supercat May 10 '13 at 23:47
-
2
32 bits, one for the sign, 31 bits of information:
2^31 - 1 = 2147483647
Why -1?
Because the first is zero, so the greatest is the count minus one.
EDIT for cantfindaname88
The count is 2^31 but the greatest can't be 2147483648 (2^31) because we count from 0, not 1.
Rank 1 2 3 4 5 6 ... 2147483648
Number 0 1 2 3 4 5 ... 2147483647
Another explanation with only 3 bits : 1 for the sign, 2 for the information
2^2 - 1 = 3
Below all the possible values with 3 bits: (2^3 = 8 values)
1: 100 ==> -4
2: 101 ==> -3
3: 110 ==> -2
4: 111 ==> -1
5: 000 ==> 0
6: 001 ==> 1
7: 010 ==> 2
8: 011 ==> 3
-
@cantfindaname88: 2^31 = total combinations, so it ranges from 0 to (2^31 -1). Yes the first is 0. – Luciano Aug 12 '15 at 12:37
Well, it has 32 bits and hence can store 2^32 different values. Half of those are negative.
The solution is 2,147,483,647
And the lowest is −2,147,483,648.
(Notice that there is one more negative value.)
Well, aside from jokes, if you're really looking for a useful memory rule, there is one that I always use for remembering big numbers.
You need to break down your number into parts from 3-4 digits and remember them visually using projection on your cell phone keyboard. It's easier to show on a picture:
As you can see, from now on you just have to remember 3 shapes, 2 of them looks like a Tetris L and one looks like a tick. Which is definitely much easier than memorizing a 10-digit number.
When you need to recall the number just recall the shapes, imagine/look on a phone keyboard and project the shapes on it. Perhaps initially you'll have to look at the keyboard but after just a bit of practice, you'll remember that numbers are going from top-left to bottom-right so you will be able to simply imagine it in your head.
Just make sure you remember the direction of shapes and the number of digits in each shape (for instance, in 2147483647 example we have a 4-digit Tetris L and a 3-digit L).
You can use this technique to easily remember any important numbers (for instance, I remembered my 16-digit credit card number etc.).

- 3,762
- 1
- 21
- 35
-
Neat idea! Shape 1 gives you 2147, Shape 2 gives you 483, and Shape 3 is supposed to give 647, but as drawn, it could be interpreted as 6**5**47. How do I know when to include all the crossed numbers (as in Shape 1) vs. when to skip some (as in Shape 3)? You also have to memorize that the shapes encode 4, 3, and 3 digits, respectively. Or you could draw Shape 3 with an arc from 6 to 4 instead of a straight line. – jskroch Oct 19 '17 at 16:17
-
@Squinch Well, particularly for remembering int.Max it shouldn't be a problem as you might know that it's about 2 billion so it has 10 numbers in it (and that means if the first shape has 4 numbers then the second and the third shapes have 3 accordingly). However, that's a nice point if you want to use this approach for any number. Also, there are numbers that are difficult to remember using this way (i.e. 1112 or something). On the other hand, it shouldn't be difficult to remember such number anyway. So I'd say it's up to you, let me know if you come up with something interesting for this. :) – Ivan Yurchenko Oct 19 '17 at 16:30
-
Yes, I was thinking about using this method to recall an arbitrary sequence of digits, but for this particular int.Max value, your method works fairly well. As you said, repeated digits are a problem. In fact, any repeated sequence (such as 2323) is a problem. Any sequence that crosses itself (such as 2058) is difficult to draw. Any memorization technique requires you to remember several pieces of information. It's personal preference what types of info best stick in your head. – jskroch Oct 19 '17 at 19:35
-
1This is how I remember pin codes and similar, but then all of a sudden you need to type it in on your computer and realize that the numpad is vertically flipped. So that's a bit of a challenge. – nibarius May 22 '18 at 08:47
-
Somebody in [Dallas, Texas](https://www.worldatlas.com/na/us/tx/area-code-214.html), has received many strange phone calls and has no idea that you @IvanYurchenko are to blame. – Bob Stein Jun 06 '19 at 16:54
The easiest way to do this for integers is to use hexadecimal, provided that there isn't something like Int.maxInt(). The reason is this:
Max unsigned values
8-bit 0xFF
16-bit 0xFFFF
32-bit 0xFFFFFFFF
64-bit 0xFFFFFFFFFFFFFFFF
128-bit 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Signed values, using 7F as the max signed value
8-bit 0x7F
16-bit 0x7FFF
32-bit 0x7FFFFFFF
64-bit 0x7FFFFFFFFFFFFFFF
Signed values, using 80 as the max signed value
8-bit 0x80
16-bit 0x8000
32-bit 0x80000000
64-bit 0x8000000000000000
How does this work? This is very similar to the binary tactic, and each hex digit is exactly 4 bits. Also, a lot of compilers support hex a lot better than they support binary.
F hex to binary: 1111
8 hex to binary: 1000
7 hex to binary: 0111
0 hex to binary: 0000
So 7F is equal to 01111111 / 7FFF is equal to 0111111111111111. Also, if you are using this for "insanely-high constant", 7F... is safe hex, but it's easy enough to try out 7F and 80 and just print them to your screen to see which one it is.
0x7FFF + 0x0001 = 0x8000, so your loss is only one number, so using 0x7F... usually isn't a bad tradeoff for more reliable code, especially once you start using 32-bits or more

- 6,308
- 2
- 30
- 23
First write out 47 twice, (you like Agent 47, right?), keeping spaces as shown (each dash is a slot for a single digit. First 2 slots, then 4)
--47----47
Think you have 12
in hand (because 12 = a dozen). Multiply it by 4
, first digit of Agent 47's number, i.e. 47
, and place the result to the right of first pair you already have
12 * 4 = 48
--4748--47 <-- after placing 48 to the right of first 47
Then multiply 12
by 3
(in order to make second digit of Agent 47's number, which is 7
, you need 7 - 4 = 3
) and put the result to the right of the first 2 pairs, the last pair-slot
12 * 3 = 36
--47483647 <-- after placing 36 to the right of first two pairs
Finally drag digits one by one from your hand starting from right-most digit (2 in this case) and place them in the first empty slot you get
2-47483647 <-- after placing 2
2147483647 <-- after placing 1
There you have it! For negative limit, you can think of that as 1 more in absolute value than the positive limit.
Practise a few times, and you will get the hang of it!

- 16,753
- 12
- 73
- 90
2GB
(is there a minimum length for answers?)

- 815
- 6
- 17
-
9
-
1Which is why the limit of RAM you can have on a 32bit computer is 4GB – Serj Sagan May 11 '13 at 00:37
-
3the value of 4GB is correct with unsigned integers. if you have a signed int, you obviously need to divide by 2 to get the max value possible – SwissCoder May 27 '13 at 04:53
-
-
3In 32-bit there is 2GB of the memory-space reserve for user process, and 2GB for kernel. It can be configured so kernel have only 1 GB reserved – Rune Aug 27 '13 at 14:41
-
@atoMerz: You probably have a 1GB video card which only leaves 3GB for regular RAM. – Nelson Rothermel Feb 20 '14 at 15:46
If you happen to know your ASCII table off by heart and not MaxInt
:
!GH6G = 21 47 48 36 47

- 10,665
- 10
- 68
- 101
-
When I wrote this answer I didn't know GH6G had so many Google hits, and now I've used this myself :-) – Mark Hurd Feb 04 '16 at 01:36
The best rule to memorize it is:
21 (magic number!)
47 (just remember it)
48 (sequential!)
36 (21 + 15, both magics!)
47 again
Also it is easier to remember 5 pairs than 10 digits.

- 16,753
- 12
- 73
- 90

- 10,561
- 15
- 79
- 116
Interestingly, Int32.MaxValue has more characters than 2,147,486,647.
But then again, we do have code completion,
So I guess all we really have to memorize is Int3<period>M<enter>
, which is only 6 characters to type in visual studio.
UPDATE For some reason I was downvoted. The only reason I can think of is that they didn't understand my first statement.
"Int32.MaxValue" takes at most 14 characters to type. 2,147,486,647 takes either 10 or 13 characters to type depending on if you put the commas in or not.
-
2But what counts is not how many characters you have to type, but how to memoize it. I'm sure `Iwannagohome` is easier to memoize than `298347829`. No reason for a -1, however. – glglgl Nov 25 '13 at 17:47
-
3It could be less than that, just make your own max value snippet, "imv"
perhaps? -
4Characters `!=` Keystrokes. For this poor .Net user, it's `in`+`.`+`ma`+Return. – Michael Mar 13 '14 at 19:40
The easiest way to remember is to look at std::numeric_limits< int >::max()
For example (from MSDN),
// numeric_limits_max.cpp
#include <iostream>
#include <limits>
using namespace std;
int main() {
cout << "The maximum value for type float is: "
<< numeric_limits<float>::max( )
<< endl;
cout << "The maximum value for type double is: "
<< numeric_limits<double>::max( )
<< endl;
cout << "The maximum value for type int is: "
<< numeric_limits<int>::max( )
<< endl;
cout << "The maximum value for type short int is: "
<< numeric_limits<short int>::max( )
<< endl;
}

- 199
- 1
- 3
Just remember that 2^(10*x) is approximately 10^(3*x) - you're probably already used to this with kilobytes/kibibytes etc. That is:
2^10 = 1024 ~= one thousand
2^20 = 1024^2 = 1048576 ~= one million
2^30 = 1024^3 = 1073741824 ~= one billion
Since an int uses 31 bits (+ ~1 bit for the sign), just double 2^30 to get approximately 2 billion. For an unsigned int using 32 bits, double again for 4 billion. The error factor gets higher the larger you go of course, but you don't need the exact value memorised (If you need it, you should be using a pre-defined constant for it anyway). The approximate value is good enough for noticing when something might be a dangerously close to overflowing.

- 116,865
- 28
- 107
- 112
-
10
-
10@Pier-OlivierThibault nope, I use it all the time! now I need to find out why all my math is coming out wrong. probably something to do with multiplication errors. anyway, bye! – tckmn May 11 '13 at 21:31
this is how i do it to remember 2,147,483,647
To a far savannah quarter optimus trio hexed forty septenary
2 - To
1 - A
4 - Far
7 - Savannah
4 - Quarter
8 - Optimus
3 - Trio
6 - Hexed
4 - Forty
7 - Septenary

- 9,883
- 5
- 45
- 57
What do you mean? It should be easy enough to remember that it is 2^32. If you want a rule to memorize the value of that number, a handy rule of thumb is for converting between binary and decimal in general:
2^10 ~ 1000
which means 2^20 ~ 1,000,000
and 2^30 ~ 1,000,000,000
Double that (2^31) is rounghly 2 billion, and doubling that again (2^32) is 4 billion.
It's an easy way to get a rough estimate of any binary number. 10 zeroes in binary becomes 3 zeroes in decimal.

- 243,077
- 51
- 345
- 550
In Objective-C (iOS & OSX), just remember these macros:
#define INT8_MAX 127
#define INT16_MAX 32767
#define INT32_MAX 2147483647
#define INT64_MAX 9223372036854775807LL
#define UINT8_MAX 255
#define UINT16_MAX 65535
#define UINT32_MAX 4294967295U
#define UINT64_MAX 18446744073709551615ULL

- 3,723
- 1
- 23
- 30
Int32 means you have 32 bits available to store your number. The highest bit is the sign-bit, this indicates if the number is positive or negative. So you have 2^31 bits for positive and negative numbers.
With zero being a positive number you get the logical range of (mentioned before)
+2147483647 to -2147483648
If you think that is to small, use Int64:
+9223372036854775807 to -9223372036854775808
And why the hell you want to remember this number? To use in your code? You should always use Int32.MaxValue or Int32.MinValue in your code since these are static values (within the .net core) and thus faster in use than creating a new int with code.
My statement: if know this number by memory.. you're just showing off!
-
2Most modern computers store numbers in "twos compliment" format. The highest (not lowest) bit is the sign. The neat thing with twos compement is that -ve numbers are handled by the natural overflow rules of the CPU. i.e 0xFF is 8 bit -1, add that to 0x01 (+1) and you get 0x100. Truncate bits above 8 to 0x00 and you have your answer. – Tom Leys Jun 17 '09 at 09:27
Remember this: 21 IQ ITEM 47
It can be de-encoded with any phone pad, or you can just write one down yourself on a paper.
In order to remember "21 IQ ITEM 47", I would go with "Hitman:Codename 47 had 21 missions, which were each IQ ITEM's by themselves".
Or "I clean teeth at 21:47 every day, because I have high IQ and don't like items in my mouth".

- 326
- 2
- 6
Just remember that it's the eighth Mersenne prime.
If that's too hard, it's also the third of only four known double Mersenne primes.
Edit per comment request:
The Euclid-Euler theorem states that every even perfect number has the form 2^(n − 1) (2^n − 1), where 2^n − 1 is a prime number. The prime numbers of the form 2^n − 1 are known as Mersenne primes, and require n itself to be prime.
We know that the length of an INT32 is of course 32 bits. Given the generally accepted understanding of 2's complement, a signed INT32 is 32 bits - 1 bit.
To find the magnitude of a binary number with a given number of bits we generally raise 2 to the power n, minus 1, where n is equal to the number of bits.
Thus the magnitude calculation is 2^(32 - 1) - 1 = 2^31 - 1. 31 is prime and as outlined above, prime numbers of this form are Mersenne primes. We can prove it is the eight of such simply by counting them. For further details, please ask Euler, or maybe Bernoulli (to whom he wrote about them).

- 9,696
- 16
- 68
- 132
-
Any Reference you could link to...? (Directly, without having to google/wikipediaze...) – chivracq Aug 29 '18 at 03:40
2147483647
Here's what you need to remember:
- It's 2 billion.
- The next three triplets are increasing like so: 100s, 400s, 600s
- The first and the last triplet need 3 added to them so they get rounded up to 50 (eg 147 + 3 = 150 & 647 + 3 = 650)
- The second triplet needs 3 subtracted from it to round it down to 80 (eg 483 - 3 = 480)
Hence 2, 147, 483, 647

- 774
- 1
- 10
- 23
I made a couple genius methods in C# that you can take advantage of in your production environment:
public static int GetIntMaxValueGenius1()
{
int n = 0;
while (++n > 0) { }
return --n;
}
public static int GetIntMaxValueGenius2()
{
int n = 0;
try
{
while (true)
n = checked(n + 1);
}
catch { }
return n;
}

- 4,512
- 6
- 44
- 66
-
1I was thinking of some kind of method that would guess trillions of random integers, and return the highest one. – Slothario Jan 09 '19 at 21:55
With Groovy on the path:
groovy -e " println Integer.MAX_VALUE "
(Groovy is extremely useful for quick reference, within a Java context.)

- 30,738
- 21
- 105
- 131

- 23,733
- 7
- 76
- 107
To never forget the maximum value of any type:
If it has 32 bits, the largest possible value would be the 32 bits with the number 1:
The result would be 4294967295 in decimal:
But, as there is also the representation of negative numbers, divide 4294967295 by 2 and get 2147483647.
Therefore, a 32-bit integer is capable of representing -2147483647 to 2147483647

- 1,022
- 11
- 20
-
You can, you know, just get 2^31 (which is indeed also how it is stored in ram- one bit for positive/negative flag and 31 bits for the number), which will automatically be the half. And subtract one for the number zero (in your case you get 2147483647.5, not 2147483647 as you don't account for that). – ave May 06 '17 at 09:46
This is how I remember...
In hex, a digit represents four bits, so 4 * 8 = 32, so the max signed 32 bit int is:
0xFFFFFFFF >> 1 # => 2147483647

- 1,084
- 1
- 13
- 24
-
This would probably work. I wish the guy that downvoted you would give you an explanation. – Joe Plante Aug 15 '13 at 17:41
-
3@JoePlante The question asker was asking for a way that he, as a human, could memorize the number (as in, its decimal digits). I don't know about you, but parsing hexadecimal and then bit shifting isn't an intuitive operation on my mental hardware. If you're going to take this approach, you might as well just calculate 2^31-1. – Mark Amery Aug 27 '13 at 19:56
-
The question I was answering was "What is the maximum value for a int32?" I do see your point @MarkAmery, but remembering to type this line into an interpreter or into a print statement is actually how I remember the numbers. It also works as a general pattern for other sizes. Thank you for the support @JoePlante! – Sean Vikoren Aug 28 '13 at 22:57
-
No problem. After 16 bits, I simply stopped memorizing because you can always look it up. 0xFFFFFFFF >> 1 I feel is correct in a lot of cases because if you need to go to 64 bits, 0xFFFFFFFFFFFFFFFF >> 1 also works. 0xFFFF >> 1 and 0xFF >> 1 also works. I'm not sure if this works in languages with signed values or not, but still I feel it's viable – Joe Plante Sep 01 '13 at 14:20
You will find in binary the maximum value of an Int32 is 1111111111111111111111111111111 but in ten based you will find it is 2147483647 or 2^31-1 or Int32.MaxValue

- 1,905
- 1
- 18
- 36
Using Java 9's REPL, jshell:
$ jshell
| Welcome to JShell -- Version 9-Debian
jshell> System.out.println(Integer.MAX_VALUE)
2147483647

- 23,733
- 7
- 76
- 107
It is very easy to remember. In hexadecimal one digit is 4 bits. So for unsigned int write 0x
and 8 f
s (0xffffffff
) into a Python or Ruby shell to get the value in base 10. If you need the signed value, just remember that the highest bit is used as the sign. So you have to leave that out. You only need to remember that the number where the lower 3 bits are 1 and the 4th bit is 0 equals 7, so write 0x7fffffff
into a Python or Ruby shell. You could also write 0x100000000 - 1
and 0x80000000 - 1
, if that is more easy to you to remember.

- 7,517
- 5
- 42
- 54
In C use INT32_MAX
after #include <stdint.h>
.
In C++ use INT32_MAX
after #include <cstdint>
.
Or INT_MAX
for platform-specific size or UINT32_MAX
or UINT_MAX
for unsigned int
. See http://www.cplusplus.com/reference/cstdint/ and http://www.cplusplus.com/reference/climits/.
Or sizeof(int)
.

- 1,590
- 2
- 15
- 17
In general you could do a simple operation which reflects the very nature of a Int32, fill all the available bits with 1's - That is something which you can hold easily in your memory. It works basically the same way in most languages, but i'm going with Python for the example:
max = 0
bits = [1] * 31 # Generate a "bit array" filled with 1's
for bit in bits:
max = (max << 1) | bit
# max is now 2147483647
For unsigned Int32's, make it 32 instead of 31 1's.
But since there are posted a few more adventurous approaches, i began to think of formulas, just for the fun of it...
Formula 1 (Numbers are concatenated if no operator is given)
- a = 4
- b = 8
- ba/a
- ab-1
- ab
- ab-a-b
- ab-1
Python quickcheck
a = 4
b = 8
ab = int('%d%d' % (a, b))
ba = int('%d%d' % (b, a))
'%d%d%d%d%d' % (ba/a, ab-1, ab, ab-a-b, ab-1)
# gives '2147483647'
Formula 2
- x = 48
- x/2-3
- x-1
- x
- x*3/4
- x-1
Python quickcheck
x = 48
'%d%d%d%d%d' % (x/2-3, x-1, x, x*3/4, x-1)
# gives '2147483647'

- 2,349
- 12
- 21
"If a huge integer isn't recalled, you recall this mnemonic."
Now count the letters in each word.

- 361
- 4
- 25
max_signed_32_bit_num = 1 << 31 - 1; // alternatively ~(1 << 31)
A compiler should optimize it anyway.
I prefer 1 << 31 - 1
over
0x7fffffff
because you don't need count f
s
unsigned( pow( 2, 31 ) ) - 1
because you don't need <math.h>

- 144
- 7
-
You can use underscores to improve the readability of some languages. Java and Swift support this from what I know, perhaps others. `0x7FFF_FFFF` – Alexander Mar 18 '17 at 17:18
It's 231 − 1 (32 bits, one is used for sign).
If you want an approximate value, use 210 = 1024 ≈ 103, so 231 ≈ 2*109. If you want to compute an exact value by hand, use exponentiation by squaring to get to 232 = 2(25) and divide by two. You only need to square five times to get 232:
2*2 = 4
4*4 = 16
16*16 = 256
256*256 = 25*25*100 + 2*250*6 + 36 = 62500 + 3000 + 36 = 65536
65536*65536 =65000*65000 + 2*65000*536 + 536*536 =
4225000000 + 130000*536 + (250000 + 3600 + 36*36) =
4225000000 + 69680000 + 250000 + 3600 + 1296 =
4294967296
dividing this by two and subtracting one gives you 2,147,483,647. If you don't need all digits, but only want say, the first three significant digits, the computations on each squaring step are very easy.