Skip to content

Number Base Converter — Binary, Octal, Decimal, Hex

Convert numbers between binary, octal, decimal, and hexadecimal — free, instant, and browser-based.

Last updated:

What Are Number Bases?

Every number system you use daily is a positional system -- the value of each digit depends on its position within the number. The system most people learn first is base-10 (decimal), which uses ten symbols (0 through 9). Each position represents a successive power of ten: the rightmost digit is multiplied by 100, the next by 101, and so on.

The same principle applies to every other base. Base-2 (binary) has two symbols (0 and 1) and each position is a power of two. Base-8 (octal) uses digits 0--7 with powers of eight, while base-16 (hexadecimal) extends the digit set with the letters A--F to represent values 10 through 15. Despite looking different on the page, they all encode the same underlying quantities -- just in different radixes.

Why Developers Use Different Bases

Different bases exist because they map naturally to different computing concepts. Choosing the right base makes data easier to read, debug, and reason about.

  • Binary (base-2) mirrors how hardware actually works. Every transistor is either on or off, so binary is the native language of CPUs, memory, and network protocols. Bit masks, flags, and bitwise operations are all expressed in binary.
  • Octal (base-8) groups three binary digits into a single symbol, which is why Unix file permissions use it. A permission like 755 is far more readable than its binary equivalent 111 101 101.
  • Hexadecimal (base-16) groups four binary digits per symbol, making it the standard shorthand for memory addresses, color codes (#FF5733), MAC addresses, and raw byte values. Two hex digits represent exactly one byte, which keeps output compact and aligned.

Knowing when to reach for each base is a core developer skill. This converter lets you switch between all four instantly so you can verify values, debug protocol dumps, or translate between documentation formats without mental arithmetic.

Converting Between Bases

The classic pen-and-paper technique is the divide-and-remainder method. To convert a decimal number to another base, repeatedly divide by the target base and record each remainder. The remainders, read in reverse order, form the result. For example, converting decimal 156 to hex: 156 / 16 = 9 remainder C (12), then 9 / 16 = 0 remainder 9, giving 9C.

There is a useful shortcut when converting between bases that are powers of two. Because 8 = 23 and 16 = 24, you can group binary digits directly. To go from binary to octal, split the binary string into groups of three bits from the right and convert each group independently. For hex, group into four bits instead. This grouping trick is why hex and octal exist in the first place -- they are compact notations for binary data.

Going the other direction -- from hex or octal back to binary -- simply expand each digit into its 4-bit or 3-bit binary equivalent. The converter on this page performs all of these steps automatically, but understanding the underlying method helps when you encounter raw values in logs, datasheets, or debugger output.

Related Tools

If you work with a specific pair of bases frequently, these dedicated converters offer a streamlined interface:

Frequently Asked Questions

What number bases are supported?
Binary (base 2), Octal (base 8), Decimal (base 10), and Hexadecimal (base 16). These are the four most commonly used number systems in computing.
What's the largest number I can convert?
Up to JavaScript's safe integer limit (2^53 - 1, or 9,007,199,254,740,991). For larger values, precision may be lost.
How is this different from the Hex to Decimal tool?
The Hex to Decimal tool converts between two specific bases. This tool converts between all four bases simultaneously, showing binary, octal, decimal, and hex results at once.
What bases are supported?
Binary (2), octal (8), decimal (10), and hexadecimal (16), plus any arbitrary base from 2 to 36. Base 36 uses digits 0-9 plus letters a-z, the widest range common in URL shorteners and short-link IDs.
Why do programmers use hex and octal?
Both map cleanly to binary (hex = 4 bits per digit, octal = 3 bits per digit) and are much easier to read than raw binary. File permissions in Unix are the most common octal use; memory addresses and color codes are the most common hex use.
Can it handle negative numbers?
The converter works with the absolute value and shows the sign separately. For two’s complement representations (how CPUs actually store negatives), use our Binary to Decimal tool with a specified bit width.

Related Tools