# How long is a 2048-bit RSA key? [closed]

On stackoverflow:

'2048 bits, or 1400 decimal digits' https://stackoverflow.com/questions/11832022/why-are-large-prime-numbers-used-in-rsa-encryption

On Wikipedia:

'RSA-2048 has 617 decimal digits (2,048 bits).' http://en.wikipedia.org/wiki/Key_size

I don't understand how many decimal digits a 2048 RSA key has.

• a 2048-bit key is 2048-bit long, it is counted with the binary system. You can represent it with 617 decimal digits using the decimal system. You can also represent it with a 256-character ASCII string. Also, AFAIK, this question is off-topic. – Adi Jun 23 '13 at 20:44
• Hi @user27296 - I guess you have spotted that a lot of your questions are being closed by the community. Each gives a reason, but if you read the faq, tour and How to Ask pages you should get a better view on what sort of questions work here. Unfortunately this one probably wouldn't go down well on Crypto either, as it is purely a question about representing binary numbers in decimal - so general reference arithmetic. – Rory Alsop Jun 23 '13 at 21:49
• Here's a cool rule-of-thumb: each 10 bits is about 1000 (1024 exactly), so divide the exponent by 10, and that's the number of groups of zeros. `2^10=~1,000`, `2^20=~1,000,000`, `2^40=~1,000,000,000,000`, etc. So 2^2048 is approx 256 (2^8) with 204 groups of zeros after it. – tylerl Jun 28 '13 at 3:08

One bit can be 0 (zero) or 1 (one). So 2048 bits gives 2^2048 distinct numbers. A decimal digit has ten possible values 0, 1, 2, ... , 9. So to find the number of decimal digits to make 2^2048 distinct number we need to solve

``````2^2048 = 10^n
``````

Take a logarithm (base 10) on both sides to get

``````2048 log(2) = n log(10)
``````

I.e.

``````n = 2048log(2) = 616.5
``````

which means you need 617 digits.

• How about the .5 digits? – user27296 Jun 23 '13 at 20:46
• @user27296: You can only have a whole number of digits. So we need at least 616.5 digits. That means that 616 digits are not enough for representing the 2^2048 numbers. You need at least 617 digits. Note that with 617 digits, you can actually represent (write) 10^617 numbers (which is larger than 2^2048). – Thomas Jun 23 '13 at 20:48

617 decimal digits. That stackoverflow answer is incorrect.

`floor(log_10(2^2048)) + 1 = 617`

• Correct answer it seems, but please explain why this formula is correct. – Luc Jun 23 '13 at 20:40
• This is really not much of a security question at all, but there are 2^2048 different values which can be represented by 2048 bits. If you want to know how many decimal digits you'd need to represent that many values, you take the log base 10 of it. – Darius Jahandarie Jun 23 '13 at 20:43
• I meant, explain in your post like others do. The answer should contain the info, not the comments on an answer ;) – Luc Jun 23 '13 at 21:03
• I did not feel like this was the right place to explain the basic math required to answer his question. Either way, it's in the comments now (and two other answers). – Darius Jahandarie Jun 23 '13 at 21:19

2048 bits are 2048 bits or binary digits. Which means 2048 digits that can be 0 or 1.

In 2048 bits you can put 3.2317...E616 different values. That's the scientific notation of a big number. 1.23E17 would mean 123000000000000000, but 3.2317E616 means actually 3231700607131100730071487668867..., or a number with total 617 decimal digits.

To make it simpler,

• in 1 bit you can store 2 different values (0 or 1).
• In 4 bits you can store 16 different values (2*2*2*2 or 2^4).
• In 8 bits you can store 256 different values (2*2*2*2*2*2*2*2 or 2^8 or 2E2).
• In 16 bits you can store 65536 different values (2^16 or 6.5536E4).
• In 32 bits you can store 4294967296 different values (2^32 or 4.2E9).
• In 64 bits you can store 2^64 or 1.8E19 different values. That's a number with 20 decimal digits (18446744073709551616).

So in 2048 bits you can store 2^2048 or 3.23E616 different values. That's a number with 617 decimal digits.

I didn't read the first article you cite entirely, but either 1400 is wrong or it's in a different context.

• 3.23E616? So, why 617 and not 616? – user27296 Jun 23 '13 at 20:51
• Look at the example I made with 2^64. That's 1.8E19 or 18446744073709551616 (20 decimal digits). – http Jun 23 '13 at 20:59
• Actually the first decimal digit can only be 0 or 1 in the case of 2^64. For the 2048-bit case, the first decimal digit can only be 0, 1, 2, or 3. So it's not "exact". The 2048 bits are comparable to the length of a number with somewhere between 616 and 617 digits. – http Jun 23 '13 at 21:03