Base Converter

Number base converter

Enter a number in any base — binary, decimal, octal or hex — and see it converted to all four at once.

Four bases at once

Programmers move between number bases constantly: decimal for everyday maths, binary for bit-level work, hexadecimal for colours, memory addresses and byte values, and occasionally octal for things like Unix file permissions. Pick the base you're starting from, type your value, and all four representations appear together. Tap any result to copy it.

Why hex and binary matter

Hexadecimal is popular because each hex digit maps neatly to exactly four binary bits, making it a compact, readable stand-in for binary — which is why colour codes (#FF8800) and byte values use it. Seeing a number in all bases side by side makes those relationships obvious and saves you from reaching for a calculator or writing a quick script.

A worked example and what the prefixes mean

Take decimal 255. In binary that's 11111111 (eight 1-bits), in octal 377, and in hexadecimal FF — one full byte, which is why FF shows up everywhere from colour channels to memory dumps. The prefixes you'll see in code label which base a literal is written in: 0x means hexadecimal (0xFF = 255), 0b means binary (0b11111111 = 255), and 0o (or a bare leading 0 in older C) means octal (0o377 = 255).

You'll meet these bases in real work: hex for CSS colours and hashes, binary for bitmasks and flags, and octal for Unix file permissions like chmod 755, where each digit encodes three permission bits.

FAQ

What bases does it convert between?
Binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16). Enter a value in any one and the other three are shown instantly.
Can I paste a hex value with a 0x prefix?
Yes — a leading 0x, 0b or 0o prefix is accepted and ignored when you've selected the matching base.
Why does one hex digit equal four binary bits?
Hexadecimal is base 16 and 16 is 2 to the 4th power, so every hex digit covers exactly four binary digits (a nibble). That clean mapping is why hex is used as shorthand for binary: the byte 11111111 is simply FF, and 10101010 is AA.
What's the largest value one byte can hold?
A byte is 8 bits, so it holds 256 distinct values: 0 to 255 in decimal, 00000000 to 11111111 in binary, or 00 to FF in hexadecimal. That 255 ceiling is why colour channels and many byte-sized fields top out at 255.

Related tools