Number base converter
Type a number in any base and see it in binary, octal, decimal and hex at once, plus how it looks as a signed or unsigned machine integer.
tool 17 of 21 []
all shortcuts ?
How to use it
- Choose the base your number is written in, then type it. Prefixes 0x, 0b and 0o are accepted when they match the base, and underscores or spaces are ignored.
- The results show the same value in binary, octal, decimal and hex, grouped for reading, plus one custom base of your choice from 2 to 36.
- The two's complement table shows how the value is stored in 8, 16, 32 and 64 bits, signed and unsigned. A cell is blank when the value does not fit.
- Values are arbitrary precision (BigInt), so you can paste a 256-bit hash fragment without losing digits.
Why hex and binary line up
Sixteen is two to the fourth power, so one hex digit is exactly four bits and two hex digits are one byte. That is why memory addresses, colors (#ff5f1f is three bytes) and hash outputs are written in hex: the grouping matches the hardware. Octal does the same with three bits per digit, which is why Unix file modes such as 755 are octal.
Negative numbers in nearly every modern CPU use two's complement. To negate a value, invert the bits and add one. The same bit pattern is read as -1 when the top bit is treated as a sign and as 255 when it is not, which is why 0xFF means different things in a signed and an unsigned byte.
JavaScript numbers are 64-bit floats and are only exact for integers up to 2^53 - 1, so this tool uses BigInt for the conversion. Bitwise operators in JavaScript also truncate to 32 bits, a frequent source of surprise when you check a result by hand.
The first 16 values in each base
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
Generated by code when the page is built. Each hex digit is exactly four binary digits.
Examples
Select an example to load it into the tool.
- 255 decimal
255 - 0xFF hex
0xFF - Negative byte
-1 - Binary 1010_0101
0b1010_0101
Frequently asked questions
How do I convert hex to decimal?
Choose input base 16, type the hex digits (0x is optional) and read the decimal row. By hand, multiply each digit by a power of 16 and add: 0xFF is 15 times 16 plus 15, which is 255.
What is the largest number it handles?
There is no fixed limit. BigInt grows as needed, so only your browser memory and patience limit it. The two's complement table covers 8 to 64 bits and leaves a cell blank when the value does not fit.
Does it handle fractions?
No. It converts integers only. Floating point has its own binary layout (IEEE 754), which is a different conversion.
Why do bases above 10 use letters?
After 9, digits continue as a, b, c and so on. Base 16 uses a to f. Base 36 uses all ten digits and all 26 letters, the highest base this tool offers.
Is anything uploaded?
No. The conversion happens in this tab. The test suite fails the build if this tool contains a network call.
Sources
- ECMAScript: BigInt (MDN) checked 2026-10-21
- Two's complement (Wikipedia) checked 2026-10-21