Base Converter

Convert numbers between binary, octal, decimal and hexadecimal.

Your result will appear here

Fill in the fields and press Calculate.

Numbers can be written in different bases — the decimal (base 10) we use daily, the binary (base 2) computers run on, and the octal and hexadecimal shorthands programmers use. Converting between them is essential in computing, from reading colour codes to debugging memory. The value is the same; only the representation changes.

Enter a number, pick the source and target base, and the conversion is done instantly.

How is it calculated?

The bases

BaseNameDigits
2Binary0, 1
8Octal0–7
10Decimal0–9
16Hexadecimal0–9, A–F

Hexadecimal uses A–F for the values 10–15, so a single hex digit represents four binary digits — which is why hex is a compact way to write binary.

How conversion works

Every number has one value; the base is just how it's written. 255 in decimal is FF in hexadecimal and 11111111 in binary — all the same quantity. To convert, the tool reads the number in its source base and re-expresses it in the target base.

Where it's used

  • Colours: web colours are hex (FF0000 = red = 255,0,0 in RGB).
  • Programming: memory addresses, bit masks and flags in hex or binary.
  • Networking: IP addresses and subnet masks.
  • Digital electronics: binary logic, octal permissions (chmod 755).

A quick check

Each hex digit maps to exactly 4 binary digits: F = 1111, so FF = 11111111. And 2¹⁰ = 1024 is why memory sizes come in powers of two — a direct consequence of binary.

Worked example

Take 255 in decimal. In hexadecimal it's FF (15 × 16 + 15 = 255, and F represents 15), and in binary it's 11111111 (eight 1s, since 255 = 2⁸ − 1). All three write the same quantity. Converting the other way, the binary number 1010 is 1×8 + 0×4 + 1×2 + 0×1 = 10 in decimal, which is A in hexadecimal — showing how a four-bit group maps neatly to a single hex digit.

FAQ

How do I convert between number bases?+

Enter the number, choose its current (source) base and the target base. The value stays the same; only its representation changes. 255 decimal is FF hex and 11111111 binary.

What is hexadecimal used for?+

Hex (base 16) compactly represents binary — each hex digit is 4 bits. It's used for web colours (FF0000 = red), memory addresses, and bit flags in programming.

Why do computers use binary?+

Binary (base 2) has just two digits, 0 and 1, which map directly to the off/on states of electronic circuits. All data in a computer is ultimately binary.

How does a hex digit relate to binary?+

Each hexadecimal digit corresponds to exactly four binary digits: F = 1111, A = 1010. So FF = 11111111. That 4-to-1 mapping is why hex is a compact way to write binary.

What is 255 in binary and hexadecimal?+

255 is 11111111 in binary (eight 1s, 2⁸ − 1) and FF in hexadecimal. It is the maximum value of a single byte, which is why colour channels run 0–255.

What does the "0x" prefix mean?+

In many programming languages 0x marks a hexadecimal number (0xFF = 255), and 0b marks binary (0b1010 = 10). They tell the reader which base is being used.