Converters
By ToolzBank Team•
3 min read
•Monday, October 19, 2026•Updated Saturday, November 14, 2026

How to Convert Binary, Decimal and Hexadecimal (With Examples)

How number bases work, step-by-step binary and hex conversions with worked examples, and a converter that handles any base from 2 to 36.

#binary to decimal#decimal to binary#hex to decimal#number base converter

Computers store everything as binary, programmers read memory addresses and colors in hexadecimal, and people count in decimal. Converting between these number bases is a basic skill for programming, networking and electronics — and easier than it looks.

How number bases work

In base 10, each position is worth ten times the one to its right: 345 = 3×100 + 4×10 + 5×1. Base 2 (binary) uses powers of two and only the digits 0 and 1. Base 16 (hexadecimal) uses powers of sixteen and the digits 0–9 plus A–F for 10–15. Octal (base 8) uses 0–7.

Binary to decimal

Multiply each digit by its power of two and add them up. For 1011: 1×8 + 0×4 + 1×2 + 1×1 = 11.

Decimal to binary

Divide by 2 repeatedly and write the remainders from last to first. For 13: 13÷2 = 6 r1, 6÷2 = 3 r0, 3÷2 = 1 r1, 1÷2 = 0 r1 → 1101.

Hexadecimal

Each hex digit equals exactly four binary digits, which is why hex is a compact way to write binary. FF = 15×16 + 15 = 255 = 1111 1111. That is why a byte ranges from 00 to FF, and why color codes like #4564B5 are three bytes: 0x45 = 69, 0x64 = 100, 0xB5 = 181.

How to convert it online

  1. Open the Number Base Converter.
  2. Type a number into the Binary, Octal, Decimal or Hexadecimal box — the others update immediately. Prefixes like 0x, 0b and 0o are accepted.
  3. Use the custom field for any base from 2 to 36.

Conversions use arbitrary-precision integers, so even very large numbers convert exactly. Negative whole numbers work too; fractions are not supported. For color codes specifically, the Color Converter turns HEX into RGB and HSL.

Frequently Asked Questions

How do I convert binary to decimal?

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

Why is hexadecimal used in programming?

One hex digit represents exactly four bits, so hex writes binary values compactly — a byte is always two hex digits, from 00 to FF.

What is 255 in binary and hex?

255 is 11111111 in binary and FF in hexadecimal.

Can the converter handle very large numbers?

Yes. It uses arbitrary-precision integers, so numbers far larger than 64 bits convert exactly.