Number Base Converter

Convert numbers between the four common bases used in computing and mathematics.

Last updated: August 2026 · Written and verified by Akash Pandey

Convert between bases

Mean

—

This runs the same calculation engine as the main scientific calculator, entirely in your browser. Nothing you type is sent anywhere.

Number bases

BaseNameDigitsUsed in
10Decimal0–9Everyday math
2Binary0–1Computer hardware, logic
8Octal0–7Unix permissions, compact binary
16Hexadecimal0–9, A–FMemory addresses, colour codes, CSS

Why place value works the same way in every base

Decimal, binary, octal, and hex are all positional systems: each digit's value depends on its position, scaled by a power of the base. In decimal, "345" means 3×10² + 4×10¹ + 5×10⁰. Binary works identically with base 2 instead of base 10: "1011" means 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8+0+2+1 = 11. Nothing about place value is special to decimal - it is arbitrary that humans settled on base 10 (almost certainly because we have 10 fingers), and computers settled on base 2 because a transistor has exactly two stable states.

How binary works

Binary (base-2) uses only 0 and 1. Each position represents a power of 2: 1, 2, 4, 8, 16, 32, 64, 128. The number 11111111 in binary is 255 in decimal (128+64+32+16+8+4+2+1).

Worked examples

  1. Convert 255 decimal to binary

    255₁₀ → ?₂

    1. 255 ÷ 2 = 127 remainder 1
    2. 127 ÷ 2 = 63 remainder 1
    3. 63 ÷ 2 = 31 remainder 1
    4. 31 ÷ 2 = 15 remainder 1
    5. 15 ÷ 2 = 7 remainder 1
    6. 7 ÷ 2 = 3 remainder 1
    7. 3 ÷ 2 = 1 remainder 1
    8. 1 ÷ 2 = 0 remainder 1
    9. Read remainders bottom to top: 11111111.

    = 11111111

  2. What colour is the CSS hex code #1E90FF?

    #1E90FF → RGB

    1. Given: a hex colour split into three byte-pairs: 1E, 90, FF.
    2. Method: each pair is a base-16 number - convert using place value digit₁×16¹ + digit₀×16⁰.
    3. Calculation: 1E = 1×16 + 14 = 30, 90 = 9×16 + 0 = 144, FF = 15×16 + 15 = 255.
    4. Interpretation: #1E90FF is RGB(30, 144, 255) - a shade of blue ("Dodger Blue"). This is exactly how a browser decodes any hex colour.

    = RGB(30, 144, 255)

Hexadecimal in everyday life

HTML colours use hex: #FF5733 means red=FF (255), green=57 (87), blue=33 (51). MAC addresses, CPU registers, and memory addresses are also shown in hex because it is more compact than binary.

Frequently Asked Questions

Why do programmers use hexadecimal?

Hex is more compact than binary (one hex digit = four binary digits) and maps cleanly to bytes. A byte value 0–255 is exactly two hex digits 00–FF.

What does 0x mean?

The prefix 0x indicates a hexadecimal number in programming. For example, 0xFF = 255 in decimal.

How do I read binary quickly?

Group digits in fours from the right and convert each group to hex. 1111 1111 = FF = 255. It is easier to read binary as hex than as decimal.

What is two's complement?

Two's complement is the standard way to represent negative integers in binary. To negate a number, flip all bits and add 1. It allows subtraction using the same hardware as addition.

Why is binary important in computing?

Computers use transistors that are either on (1) or off (0). Binary directly maps to this hardware reality. All data — numbers, text, images — is ultimately stored as binary.

What is an octal number?

Octal (base-8) uses digits 0–7. Each octal digit represents exactly 3 binary digits. It was once common in Unix file permissions (chmod 755).

How do I convert decimal to hexadecimal?

Divide by 16 repeatedly. The remainders, read bottom to top, give the hex digits. Remainders 10–15 become A–F. For example, 255 ÷ 16 = 15 remainder 15 → FF.

What is the largest number representable with 8 bits?

Unsigned: 255 (11111111 in binary). Signed (two's complement): 127. The range is 0–255 or −128 to 127 respectively.