Number base converter
Enter one value and see it in base 2, 8, 10 and 16 together, or convert into any base up to 36. Everything is computed with BigInt, so length is not a limit — feeding a 64-bit ID to parseInt goes quietly wrong the moment it passes 2^53, and this tool exists to avoid that.
Common bases
Base 2 to base 36. Digits above nine are written a–z.
Converted
- Base 2
- 1111 1111
- Base 8
- 377
- Base 10
- 255
- Base 16
- ff
- Base 36
- 73
As bits
Written in two's complement. A negative number has no bit pattern until a width is fixed.
- 8 bit
- 11111111
- 16 bit
- 00000000 11111111
- 32 bit
- 00000000 00000000 00000000 11111111
- 64 bit
- 00000000 00000000 00000000 00000000 00000000 00000000 00000000 11111111
Read as signed -1 · Read as unsigned 255
Read as signed 255 · Read as unsigned 255
Read as signed 255 · Read as unsigned 255
Read as signed 255 · Read as unsigned 255
Values are handled as BigInt, so there is no limit on length. JavaScript's Number loses accuracy above 2^53, which is exactly where 64-bit IDs quietly come out wrong.
You only pick the base of what you typed
Base 2, 8, 10 and 16 are buttons; anything else goes in the number box, from 2 to 36. The result always lists base 2, 8, 10 and 16, and if "another base" is not one of those four it gets one more row. Digits above 9 are written a–z and case does not matter; output is lowercase.
When a value is reported unreadable
A single digit that does not exist in the chosen base makes the whole value unreadable — 9 in octal, g in hex. The 0x, 0b and 0o prefixes are stripped only when they match the base you picked, so in hex 0b10 is not binary: it is the hex number b10 (2832). Underscores, spaces and commas are treated as digit separators wherever they appear and removed.
What the bit table is saying
For each of 8, 16, 32 and 64 bits it shows the two's complement pattern in groups of eight, and the same bits read as a signed and as an unsigned integer. So 255 at 8 bits is 11111111: −1 read signed, 255 read unsigned. A width holds values from −2^(width−1) up to 2^width−1; anything outside is reported as not fitting rather than truncated.
It all stays in the browser
Everything is recomputed as you type. The value goes to no server and is stored nowhere, so internal IDs can be pasted as they are.
Frequently asked questions
How are negative numbers shown?
The value itself carries a sign, and the bit table below shows two's complement at 8, 16, 32 and 64 bits. A two's complement pattern only exists once a width is fixed, so answering “the binary of −5” without one would be a guess rather than an answer.
Can I paste 0x or 0b prefixes?
Yes, but only when they match the base you picked — in base 10, 0x10 is not a prefix, it is unreadable. Underscores, spaces and commas used as digit separators are ignored in any base.
How large a number does it take?
There is no limit; BigInt is used throughout, so hundreds of digits stay exact. The bit table stops at 64 bits, and a value that does not fit is reported as not fitting rather than truncated — a truncated value is indistinguishable from a wrong one.
Why is the signed value on the 8-bit row negative?
In two's complement a leading 1 bit means negative. 200 fits in 8 bits, but read signed it is −56. Nothing is wrong — that is the value you would get by receiving it as an int8 in code.
Are the spaces in the results part of the value?
No. Binary is grouped in fours, hex in pairs and the bit table in eights purely for reading. Remove them before using the value in code; pasting a result back into this tool works as it is.