How to convert between binary, octal, decimal and hexadecimal
Type or paste an integer in any of the four fields—Binary (base 2), Octal (base 8), Decimal (base 10), or Hexadecimal (base 16)—and the other three fields update immediately, along with the total bit length.
- Flexible input: prefixes such as
0x,0b, and0o, spaces, and underscore digit separators (1_000_000or0xFF_00_AA) are accepted, as are negative numbers. - No bit-width limit: powered by arbitrary-precision integers (
BigInt), so 64-bit, 128-bit, and 256-bit integers convert with zero floating-point rounding.
Binary, octal, decimal & hexadecimal reference table (0–15)
Because 8 = 23 and 16 = 24, every octal digit maps to a 3-bit binary group and every hexadecimal digit maps to a 4-bit binary nibble:
| Decimal (Base 10) | Hexadecimal (Base 16) | Octal (Base 8) | Binary (Base 2, 4-bit) |
|---|---|---|---|
| 0 | 0 | 0 | 0000 |
| 1 | 1 | 1 | 0001 |
| 2 | 2 | 2 | 0010 |
| 3 | 3 | 3 | 0011 |
| 4 | 4 | 4 | 0100 |
| 5 | 5 | 5 | 0101 |
| 6 | 6 | 6 | 0110 |
| 7 | 7 | 7 | 0111 |
| 8 | 8 | 10 | 1000 |
| 9 | 9 | 11 | 1001 |
| 10 | A | 12 | 1010 |
| 11 | B | 13 | 1011 |
| 12 | C | 14 | 1100 |
| 13 | D | 15 | 1101 |
| 14 | E | 16 | 1110 |
| 15 | F | 17 | 1111 |
Frequently asked questions
- Why do programmers use hexadecimal (base 16) instead of binary (base 2)?
- Because 16 is 24, each hexadecimal digit (
0–9,A–F) maps to exactly 4 binary bits (a nibble), and two hex digits represent 1 byte (8 bits,00toFF). Hexadecimal makes binary memory addresses, byte arrays, bitwise masks, and RGB colors compact and easy to read. - What is the largest number this base converter can handle?
- There is no 32-bit or 64-bit limit. The converter uses arbitrary-precision integers (
BigInt), so 128-bit UUIDs, 256-bit cryptographic hashes, and numbers hundreds of digits long convert with exact bit-for-bit accuracy. - Can I paste numbers with 0x, 0b, or 0o prefixes or underscore separators?
- Yes. Standard programming prefixes (
0xfor hex,0bfor binary,0ofor octal), spaces, underscores (such as1_000_000or0xFF_00_AA), and negative signs are automatically recognized.