Number Base Converter (Binary / Decimal / Hex / Octal)

Convert whole numbers between binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16). Enter a value in any base — the result shows it in all four at once, the way programmers actually need it.

Digits valid for the selected base (hex may use A–F)
Result

How to use this calculator

  1. Type your value — prefixes like 0x or 0b are accepted and ignored.
  2. Select which base your value is written in.
  3. Press Convert to see the number in binary, octal, decimal and hex simultaneously.

Formula used

Value = Σ digitᵢ × baseⁱ (rightmost digit is position 0)

Every positional system works the same way: each digit is multiplied by the base raised to its position. 255 in decimal = 2×10² + 5×10¹ + 5×10⁰; FF in hex = 15×16¹ + 15×16⁰ = 255. Hex digits A–F represent 10–15.

Example calculation

Worked example

255 (decimal) = 1111 1111 binary = 377 octal = FF hex — the largest value one byte can hold.

Going the other way, hex 1A3 = 1×256 + 10×16 + 3 = 419 decimal.

Why different number bases exist

Computers store everything in binary because circuits have two states. But binary is unreadable for humans — so hexadecimal packs each group of 4 bits into a single digit (0–9, A–F), which is why memory addresses, color codes (#FF5733) and hashes are written in hex. Octal groups 3 bits and survives mainly in Unix file permissions (chmod 755).

The bases are just different spellings of the same quantity: FF, 1111 1111, 377 and 255 are one number. Fluency in reading between them is a small skill that makes low-level debugging, networking and CSS colors dramatically less mysterious.

Why use this calculator?

Frequently asked questions

How do I convert binary to decimal by hand?

Multiply each bit by its power of 2 and add. 1011 = 1×8 + 0×4 + 1×2 + 1×1 = 11. Working right to left, the place values double: 1, 2, 4, 8, 16…

Why does hexadecimal use letters?

Base 16 needs sixteen distinct digits, but we only have ten numerals — so A through F stand for 10 through 15. Hex is popular because one hex digit exactly represents four binary bits, making conversions trivial.

What is the biggest number a byte can store?

A byte is 8 bits, so 2⁸ = 256 values: 0 to 255 (FF in hex). That's why RGB color channels run 0–255 and why 255 appears constantly in computing.

Related calculators