🔢 Math

🔢 🔢 Number Base Converter: Binary, Octal, Decimal, and Hexadecimal

Learn how to convert numbers between binary (base-2), octal (base-8), decimal (base-10), and hexadecimal (base-16). Covers conversion methods with step-by-step worked examples.

⏱️ 8 min read🦉 365tool.net🌍 For everyone worldwide

Number bases — also called radixes — are the foundation of how numbers are represented in different systems. While we use base-10 (decimal) in everyday life, computers use base-2 (binary), programmers frequently work with base-16 (hexadecimal), and Unix/Linux file permissions use base-8 (octal). Being fluent in converting between these four systems is a fundamental skill for anyone working with computers, programming, or electronics.

Understanding Number Bases

In any base-n system, each position represents a power of n, and digits can only range from 0 to n−1:

  • Base 10 (Decimal): Digits 0–9, positions are powers of 10
  • Base 2 (Binary): Digits 0–1, positions are powers of 2
  • Base 8 (Octal): Digits 0–7, positions are powers of 8
  • Base 16 (Hexadecimal): Digits 0–9 and A–F, positions are powers of 16

Converting Any Base to Decimal

Multiply each digit by its positional value (base^position) and sum the results.

Binary to Decimal

Binary 1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11

Octal to Decimal

Octal 275₈ = 2×8² + 7×8¹ + 5×8⁰ = 128 + 56 + 5 = 189

Hexadecimal to Decimal

Hex 2A3₁₆ = 2×16² + 10×16¹ + 3×16⁰ = 512 + 160 + 3 = 675

(Remember: A=10, B=11, C=12, D=13, E=14, F=15)

Converting Decimal to Any Base

Repeatedly divide by the target base, collecting remainders. Read remainders bottom-to-top.

Decimal to Binary: Convert 45

  • 45 ÷ 2 = 22 remainder 1
  • 22 ÷ 2 = 11 remainder 0
  • 11 ÷ 2 = 5 remainder 1
  • 5 ÷ 2 = 2 remainder 1
  • 2 ÷ 2 = 1 remainder 0
  • 1 ÷ 2 = 0 remainder 1
  • Read bottom-to-top: 101101₂

Verify: 32+8+4+1 = 45 ✓

Decimal to Hexadecimal: Convert 255

  • 255 ÷ 16 = 15 remainder 15 (F)
  • 15 ÷ 16 = 0 remainder 15 (F)
  • Read bottom-to-top: FF₁₆

Verify: 15×16 + 15 = 240 + 15 = 255 ✓

Converting Between Binary and Hex (The Shortcut)

Each hex digit represents exactly 4 binary digits. This makes binary-hex conversion trivial:

Hex Binary Decimal
000000
501015
910019
A101010
F111115

Binary to Hex (Group into 4s)

Binary: 1101 1010 → D A → Hex: DA₁₆

Hex to Binary (Expand Each Digit)

Hex 3F₁₆ → 3=0011, F=1111 → Binary: 0011 1111₂

Converting Between Binary and Octal

Each octal digit represents exactly 3 binary digits:

Binary to Octal (Group into 3s from right)

Binary: 101 111 → 5 7 → Octal: 57₈

Octal to Binary (Expand each digit to 3 bits)

Octal 37₈ → 3=011, 7=111 → Binary: 011111₂ = 31 in decimal

Practical Uses of Each Base

  • Binary: All computer hardware, logic gates, processor instructions, memory addressing
  • Octal: Unix/Linux file permissions (chmod 755 = 111 101 101 in binary = rwx r-x r-x)
  • Hexadecimal: Web colors (#FF8800), memory addresses, machine code, data encoding, IPv6 addresses
  • Decimal: Human-readable numbers, everyday arithmetic, most application-layer data

Try It Yourself! ✨

Use our free Number Base Converter — results appear as you type. No sign-up needed!

🚀 Open Number Base Converter Free

❓ 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 sum the results. Binary 1101: (1×8) + (1×4) + (0×2) + (1×1) = 8+4+0+1 = 13. Or use the shortcut: from right to left, double and add each bit: 1→2→4+1=5→10+1=11→22+1=23... no, easier: sum the positional values (8,4,2,1) where the binary digit is 1.
How do I convert decimal to binary?
Repeatedly divide by 2 and record remainders. Read remainders bottom-to-top. For 37: 37÷2=18 r1, 18÷2=9 r0, 9÷2=4 r1, 4÷2=2 r0, 2÷2=1 r0, 1÷2=0 r1 → reading up: 100101₂. Verify: 32+0+0+4+0+1=37 ✓
How do hexadecimal and binary relate?
Each hex digit represents exactly 4 binary digits (bits). To convert binary to hex: group bits in 4s from the right, convert each group. 1010 1111 → A F → 0xAF. To convert hex to binary: expand each hex digit to 4 bits. 0xB3 → 1011 0011. This makes hex a compact shorthand for binary data.
What is octal and where is it used?
Octal is base-8, using digits 0–7. Each octal digit represents 3 binary digits. Octal is used primarily in Unix/Linux file permissions: chmod 755 means owner=7(rwx), group=5(r-x), other=5(r-x) where each number is the sum of read(4)+write(2)+execute(1) permissions.
How do I convert hexadecimal to decimal?
Multiply each hex digit by 16 raised to its position (counting from 0 on the right) and sum. For hex 2F: (2×16¹) + (15×16⁰) = 32 + 15 = 47. For hex 1A3: (1×256) + (10×16) + (3×1) = 256 + 160 + 3 = 419. Remember A=10, B=11, C=12, D=13, E=14, F=15.