StatGardenREF. DESK
Calculators/Maths/Number base converter
Maths

Number base converter calculator

Binary, octal, decimal, hex and any base to 36.

What this calculator does

A number base determines how many digits are available before a new place value begins. Decimal uses ten, binary two, hexadecimal sixteen. The underlying quantity never changes: only its written representation does.

Binary and hexadecimal dominate computing for practical reasons. Binary matches the two states of a physical switch, and hexadecimal is a compact shorthand for it, since one hex digit corresponds to exactly four binary digits. That clean mapping is why memory addresses and colour codes are written in hex.

The formula

FormulaRepeatedly divide by the target base and read the remainders in reverse

To convert to a base, divide repeatedly by that base and read the remainders in reverse. To convert from a base, multiply each digit by the base raised to its position. Bases above ten use letters A to Z for digits beyond 9.

TermMeaning
BaseHow many distinct digits the system uses.
BinaryBase 2, using 0 and 1.
OctalBase 8, using 0 to 7.
HexadecimalBase 16, using 0 to 9 and A to F.
BitOne binary digit.

The inputs explained

FieldWhat to enter
ValueThe value to convert, written in the source base. Hexadecimal letters may be upper or lower case.
From baseThe base the value is currently written in.
To baseThe base to convert it into. Every common base is shown in the results regardless.

When to use it

Reading colour codes

A hex colour such as FF8800 is three bytes: red 255, green 136, blue 0. Converting each pair to decimal is what the code actually means.

Working with permissions and flags

Unix file permissions are octal because each digit maps to exactly three permission bits. 755 in octal is 111 101 101 in binary: read, write and execute for the owner, read and execute for everyone else.

Understanding memory addresses

Addresses are written in hex because each digit covers four bits, so a 32-bit address fits in eight characters instead of thirty-two.

Checking bit lengths

The bits-needed figure tells you how many binary digits a value requires, which is what determines whether it fits in a given data type.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

Common decimal values in other bases

Values that appear frequently in computing, shown across bases.

Converting from decimal
DecimalBinaryOctalHexadecimalBits needed
10101012A4
641000000100407
1001100100144647
25511111111377FF8
102410000000000200040011
655351111111111111111177777FFFF16
255 is FF in hex and eight bits in binary: the largest value a single byte holds. 65535 is FFFF and sixteen bits, the limit of a two-byte value.

Reading hexadecimal back into decimal

Hexadecimal values of the kind found in colour codes and memory dumps.

Converting from hex
HexadecimalDecimalBinaryBits needed
A1010104
FF255111111118
1002561000000009
7FFF32,76711111111111111115
FF880016,746,49611111111100010000000000024
DEADBEEF3,735,928,5591101111010101101101111101110111132
Every hex digit maps to exactly four bits, so the bit length is always four times the number of hex digits: which is what makes hex such a convenient shorthand for binary.

Questions

Why does computing use binary?

Because a physical switch has two reliable states: on and off, high and low voltage. Two states can be distinguished robustly in the presence of noise, whereas ten distinct voltage levels could not.

Why hexadecimal rather than decimal?

Because 16 is a power of 2, so each hex digit corresponds to exactly four binary digits. Conversion is a lookup rather than a calculation, and long binary strings become compact and readable.

How do I convert binary to decimal by hand?

Multiply each digit by 2 raised to its position, counting from zero on the right, then add. 1011 is 8 + 0 + 2 + 1 = 11.

What do the letters in hexadecimal mean?

They are digits beyond 9: A is 10, B is 11, up to F which is 15. Base 36 continues the pattern all the way to Z as 35.

How many bits do I need for a number?

The bit length is the floor of log₂ of the number, plus one. The calculator reports it directly, which is what determines the smallest data type that will hold the value.

For the logarithms behind bit lengths, see the logarithm calculator. For data size units, use the digital storage converter.