Skip to content

Number Base Converter

Convert between binary, octal, decimal and hexadecimal.

💾 Computing
Prefixes 0x, 0b and 0o are accepted and ignored.

Enter your values and press Calculate to see the result and the working.

Share WhatsApp Telegram X Email

What does this calculator do?

Converts a number from any base into all four common bases at once, showing them in one table along with the number of bits needed to represent it.

When would you use it?

In programming when reading colour values, bit masks or memory addresses, in computer science coursework, and when decoding hexadecimal error codes.

How the formula works

Each base uses a different number of symbols, and each digit position carries a weight that is a power of the base. In decimal the weights are 1, 10, 100; in binary 1, 2, 4, 8; in hexadecimal 1, 16, 256.

The number itself does not change — only how it is written. 255 is 11111111 in binary and FF in hexadecimal: three spellings of one quantity.

Hexadecimal is common in programming for a practical reason: each digit maps to exactly four bits, so one byte (8 bits) is written with just two characters instead of eight ones and zeros. It is a readable shorthand for binary rather than a separate system.

What does the result mean?

The table shows all four representations of the same value. The bit count tells you the smallest storage it fits in: a number needing 9 bits will not fit in a single byte.

Common mistakes

Treating A–F as letters rather than digits is the classic error — in hexadecimal A is 10 and F is 15. Another is entering a 2 in a binary number, where that symbol does not exist.

Worked example

A full byte

How is 255 written in the other bases?

It is 11111111 in binary and FF in hexadecimal — the largest value that fits in one byte.

From hexadecimal

What is FF in decimal?