Skip to main content

Binary, Decimal, Hex & Octal Number Base Converter

Convert binary, decimal, hexadecimal, and octal instantly. Includes 8-bit, 16-bit, and 32-bit binary representations.

Binary bit-length view

WidthValue
8-bit11111111
16-bit0000000011111111
32-bit00000000000000000000000011111111
64-bit0000000000000000000000000000000000000000000000000000000011111111

New to number bases? Binary, decimal and hex explained simply shows how each base counts and how to convert between them by hand.

How number base conversion works

A number base sets how many digits each place can hold before it carries. Decimal (base 10) uses 0–9 and each place is worth ten times the one to its right. Binary (base 2) uses only 0 and 1, so the places are worth 1, 2, 4, 8, 16 and so on. Octal (base 8) uses 0–7. Hexadecimal (base 16) uses 0–9 and then A–F for ten to fifteen.

To convert to decimal, multiply each digit by its place value and add. To convert from decimal, divide by the base repeatedly and read the remainders from last to first. Because 16 is 2⁴ and 8 is 2³, binary converts to hex by grouping bits in fours and to octal by grouping in threes, with no arithmetic at all.

Worked examples

Binary to decimal

1011 0110 = 128 + 32 + 16 + 4 + 2 = 182. Add the place values wherever there is a 1.

Decimal to binary by repeated division

45 ÷ 2 = 22 r1, 22 ÷ 2 = 11 r0, 11 ÷ 2 = 5 r1, 5 ÷ 2 = 2 r1, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1. Reading the remainders upward gives 101101.

Binary to hex by grouping

1101 0111 1010: 1101 = D, 0111 = 7, 1010 = A, so the hex value is D7A, which is 3,450 in decimal.

Hex to decimal

2F = 2 × 16 + 15 = 47. 1A3 = 1 × 256 + 10 × 16 + 3 = 419.

Decimal, binary, octal and hex side by side

DecimalBinaryOctalHex
0000
1111
21022
711177
81000108
91001119
10101012A
15111117F
16100002010
3111111371F
321000004020
64100000010040
100110010014464
12711111111777F
1281000000020080
25511111111377FF
256100000000400100
1,000111110100017503E8
1,023111111111117773FF
1,024100000000002000400
4,0951111111111117777FFF
65,5351111111111111111177777FFFF

Common mistakes

  • Reading the remainders top to bottom. In repeated division, the first remainder is the lowest bit, so read from the last remainder up.
  • Grouping bits from the left. Group from the right and pad the leftmost group with zeros: 101101 is 10 1101 → 0010 1101 = 2D.
  • Forgetting that 0x, 0b and 0o are prefixes, not digits. 0x1F is hex 1F (31); type 1F into the hex box.
  • Ignoring bit width for negative numbers. Computers store negative integers in two's complement at a fixed width (8, 16, 32 or 64 bits); this tool converts non-negative whole numbers.

Frequently asked questions

What is 255 in binary?

255 decimal equals 11111111 in binary (8 bits, all ones) and FF in hexadecimal.

How do I convert decimal to binary?

Divide the number by 2 repeatedly and write down each remainder, then read the remainders from last to first. For example, 13 → 1101.

Why is hexadecimal used in computing?

Each hex digit stands for exactly 4 bits, so one byte is always two hex digits (00–FF). That makes memory addresses, byte values and color codes like #FF8800 short and easy to read.

What is FF in decimal?

FF hexadecimal equals 255 in decimal.

How do I convert binary to hex?

Group the binary digits in fours from the right and convert each group to a single hex digit (0–F).

What is 1010 in decimal?

1010 in binary is 8 + 2 = 10 in decimal (A in hex).

How many values can 8 bits hold?

2⁸ = 256 values, from 0 to 255 (00 to FF in hex).