ToolBook
Support us on Ko-fi
Help us keep this free, forever

Number Base Converter

How to convert between number bases online

Convert any integer between decimal, binary, hexadecimal, and octal using ToolBook's live number base converter.

  1. Enter a number in any field

    Type a value in the decimal, binary, hex, or octal input — all four representations update simultaneously as you type.

  2. Read all converted values

    The remaining three fields update in real time. Binary is displayed in groups of 4 bits (nibbles) for easy reading.

  3. Check the bit length and storage type

    The bit-length badge shows whether the value fits in 8, 16, 32, or 64 bits — useful for choosing the right integer type in your code.

  4. View ASCII, color preview, or signed interpretation

    Printable ASCII values (32–126) show the matching character, valid 3 or 6-digit hex values show a live color swatch, and 32-bit values with the high bit set show their signed two's complement interpretation.

  5. Copy any representation

    Click the copy icon next to any field to copy that specific value to your clipboard.

Frequently asked questions

What are the different number bases?

Decimal (base 10) uses digits 0–9 and is the everyday number system. Binary (base 2) uses only 0 and 1 — the native language of computers. Octal (base 8) uses digits 0–7 and is common in Unix file permissions. Hexadecimal (base 16) uses 0–9 and A–F and is ubiquitous in memory addresses, color codes, and byte representations.

Why does the binary show spaces?

The binary output is formatted in groups of 4 bits (nibbles). This makes large binary numbers easier to read and maps naturally to hex digits — each hex digit is exactly one nibble. For example, 0xFF = 1111 1111.

What does the bit length mean?

Bit length is the minimum number of bits needed to represent the number. For example, 255 needs 8 bits (1111 1111), and 256 needs 9 bits. This tells you whether a value fits in a uint8, uint16, uint32, or uint64 storage type — useful when working with C types, Rust integers, or protocol buffers.

What is hexadecimal used for in web development?

Hex is everywhere in web development: HTML/CSS color codes (#FF6B2B), binary file signatures (magic bytes), crypto hashes, memory addresses, and Unicode code points. Converting quickly between hex and decimal or binary is a daily developer task.

Why do Unix file permissions use octal?

Unix permissions are 9-bit values (3 bits each for owner, group, and others). Each group of 3 bits maps to one octal digit (0–7), making chmod 755 a natural shorthand for rwxr-xr-x (111 101 101 in binary).

Can I use this tool to convert hex color codes?

Yes. Enter a 3 or 6-digit hex value (without the # prefix) and the tool shows a live color swatch alongside the decimal and binary equivalents. This is handy for decoding CSS colors — for example, FF6B2B converts to decimal 16,739,115, which you can also express as rgb(255, 107, 43).

What ASCII character does a decimal number represent?

For decimal values in the printable ASCII range (32–126), the tool shows the corresponding character. For example, 65 maps to "A", 97 maps to "a", and 48 maps to "0". This is useful when debugging character encodings, binary protocols, or file headers.

What is two's complement and why does it matter?

Two's complement is the standard way CPUs represent negative integers in binary. For a 32-bit register, the value 0xFFFFFFFF is 4,294,967,295 unsigned but -1 in signed two's complement. The tool shows the signed 32-bit interpretation when you enter a value with the high bit set (0x80000000 through 0xFFFFFFFF), so you can spot potential sign-extension bugs.

What is the maximum unsigned value for 8, 16, 32, and 64-bit integers?

The max unsigned values are: 8-bit = 255 (0xFF), 16-bit = 65,535 (0xFFFF), 32-bit = 4,294,967,295 (0xFFFFFFFF), 64-bit = 18,446,744,073,709,551,615 (0xFFFFFFFFFFFFFFFF). The bit-length badge in this tool tells you which range your current number falls into.

Number bases explained: decimal, binary, hex and why computers think in powers of 2

How positional notation works across bases, and why hex is the lingua franca of low-level programming.

Positional notation and number bases

Every number system we use is positional — the value of a digit depends on its position. In decimal (base 10), the digit 3 in "305" means 300 (3 × 10²), whereas the 3 in "53" means 3 (3 × 10⁰).

The base determines how many distinct digits exist. Decimal has 10 (0–9). Binary has 2 (0 and 1). Hexadecimal has 16 (0–9 and A–F). Octal has 8 (0–7).

Why computers use binary

Transistors have two states: on and off. A single transistor reliably represents one binary digit (bit). Building circuitry for ten states (decimal) would require far more complex switching logic and be far less noise-tolerant.

Everything a computer does — addition, multiplication, storage, network transmission — is ultimately binary arithmetic on groups of 8 bits (bytes) or multiples thereof.

Hexadecimal: the developer's shorthand

Binary is awkward to write for humans — 255 is 11111111. Hex is a convenient shorthand: each hex digit maps exactly to 4 binary bits (a nibble), so FF = 1111 1111. This bijection makes hex-binary conversion mental arithmetic.

Hex is everywhere in computing:

  • Colors: #EE7A2B = red 238, green 122, blue 43
  • Memory addresses: 0x7fff5fbff5a8
  • Crypto hashes: SHA-256 outputs 64 hex characters (32 bytes)
  • Byte representations: \xDE\xAD\xBE\xEF
  • Unicode code points: U+0041 is 'A'

Octal and Unix permissions

Octal predates hex in many Unix tools because it maps cleanly to 3-bit groups. Unix file permissions are 9 bits: 3 bits each for owner, group, and others. Each group of 3 bits represents a single octal digit:

chmod 755 = rwxr-xr-x
7 = 111 (rwx)
5 = 101 (r-x)
5 = 101 (r-x)

Bit widths and data types

The bit length of a number determines which integer type can store it:

| Bits | Unsigned range | Common type | |---|---|---| | 8 | 0 – 255 | uint8, byte | | 16 | 0 – 65,535 | uint16 | | 32 | 0 – 4,294,967,295 | uint32, unsigned int | | 64 | 0 – 18.4 × 10¹⁸ | uint64, ulong |

When you see an unexpected negative number or a value wrapping around to zero, integer overflow is likely: the value exceeded the maximum for its type and wrapped around.

Converting between bases by hand

To convert from any base to decimal: multiply each digit by its base raised to its position power and sum the results.

Binary 1011 = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11.

To convert decimal to binary: repeatedly divide by 2 and read the remainders from bottom to top. 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 11011.