THE TOOLKIT Free calculators & converters

Math & School

Binary Converter

Convert non-negative integers between decimal, binary, hexadecimal, and octal — all four bases at once, with the bit length of the value shown.

Enter a value

Result — in binary

—
Decimal—
Binary—
Hexadecimal—
Octal—
Bit length—

How it works

Every base is the same idea with a different set of digits. Binary (base 2) uses only 0 and 1, and each position is worth twice the one to its right: 1, 2, 4, 8, 16, … So 1101 in binary is 8 + 4 + 0 + 1 = 13. Octal (base 8) uses digits 0–7 with positions worth 8× each step. Hexadecimal (base 16) uses 0–9 then A–F for 10–15, with positions worth 16× each step.

Hex and octal are really just shorthand for binary: each hex digit is exactly 4 bits, and each octal digit is exactly 3 bits. That is why programmers read memory, colors (#FF5733 is red 255, green 87, blue 51), and file permissions in hex and octal — the conversion back to the machine's binary is mechanical. The bit length is how many bits the value itself needs: 255 is the largest 8-bit value, so its bit length is 8.

Worked example: 255 in decimal is 11111111 in binary (eight 1s), FF in hexadecimal, and 377 in octal — an 8-bit value. Limits: this converter handles whole numbers from 0 up to 253 − 1 (9,007,199,254,740,991) exactly; larger values are refused rather than rounded, and negative numbers and fractions are not accepted.

Frequently asked questions

How do I read a binary number? Work right to left, doubling each position: the rightmost digit is worth 1, the next 2, then 4, 8, 16, and so on. Add up the positions where the digit is 1. 1010 = 8 + 2 = 10.

Why does hexadecimal use letters? Base 16 needs sixteen distinct digits, and ordinary numerals only provide ten — so A through F stand in for the values 10 through 15. A hex value may also be written with a 0x prefix (0xFF); this converter accepts that.

How many bits is a byte? 8 bits — one byte holds values from 0 to 255, which is why 255 shows up everywhere in computing and why the example above uses it.

More tools — Math & School

Every tool on this site runs in your browser. Nothing you type is sent anywhere, stored, or tracked.