Guide

How Binary, Octal and Hexadecimal Numbers Work

A number base is how many different digits a system uses. Everyday decimal uses ten (0–9), binary uses two (0 and 1), octal uses eight (0–7), and hexadecimal uses sixteen (0–9 and A–F). The number 255 is 11111111 in binary, 377 in octal, and FF in hex — same amount, different writing.

Place value is the key idea

In decimal, each place is worth ten times the one to its right: 345 = 3×100 + 4×10 + 5×1. Other bases work the same way, but with a different multiplier.

In binary each place is worth twice the previous one: 1, 2, 4, 8, 16, 32, 64, 128. So 1011 = 8 + 0 + 2 + 1 = 11 in decimal.

Convert decimal to binary

Divide by 2 repeatedly and write down the remainders, then read them from bottom to top. For 13: 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1. Reading upward gives 1101.

Check it: 8 + 4 + 0 + 1 = 13. The same divide-and-remainder method works for octal (divide by 8) and hex (divide by 16).

Why hexadecimal uses letters

Hex needs sixteen single digits, so after 9 it uses A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. The hex number 2F means 2×16 + 15 = 47.

Each hex digit equals exactly four binary digits, so programmers use hex as a short way to write binary. 1111 1111 becomes FF, and web colors like #FF8800 are three hex pairs for red, green, and blue.

Where you will see each base

Different bases show up in different places:

  • Binary: how computers store everything, as on/off bits
  • Octal: Unix file permissions such as 755
  • Hexadecimal: colors, memory addresses, and error codes
  • Decimal: everyday counting and money

Use the converter

Type a whole number into Input value, choose which base it is written in, and the Number Base Converter shows it in decimal, binary, octal, and hexadecimal at once.

If you pick Binary and type a 2, or pick Octal and type an 8, it tells you the digit is not valid for that base instead of guessing.

Try it yourself

Put this guide into practice with our free Number Base Converter — no sign-up, no download.

Open the Number Base Converter