Skip to content

General Math

Binary, Decimal, Hex, Octal: Complete Guide to Number Base Conversion

Learn how to convert between binary, decimal, hexadecimal, and octal number systems. Step-by-step method for computer science students and developers.

OurDailyCalc Team 5 min read

Different number bases exist because computers think in binary, humans prefer decimal, and programmers often use hex for brevity. Understanding conversions is essential for CS students and developers.

Why different bases?

BaseNameUsed for
2BinaryHow computers store everything
8OctalUnix file permissions (chmod 755)
10DecimalHuman counting
16HexadecimalMemory addresses, colours (#FF5733)

Decimal to binary (division method)

Repeatedly divide by 2 and collect remainders (bottom to top):

25 ÷ 2 = 12 remainder 1
12 ÷ 2 = 6  remainder 0
6  ÷ 2 = 3  remainder 0
3  ÷ 2 = 1  remainder 1
1  ÷ 2 = 0  remainder 1

25₁₀ = 11001₂ (read remainders bottom→top)

Binary to decimal (positional method)

Multiply each digit by its position value (powers of 2):

11001₂ = 1×2⁴ + 1×2³ + 0×2² + 0×2¹ + 1×2⁰
       = 16 + 8 + 0 + 0 + 1 = 25₁₀

Hexadecimal

Hex uses 0–9 and A–F (A=10, B=11, C=12, D=13, E=14, F=15).

  • Decimal 255 = FF in hex (15×16 + 15 = 255)
  • Hex colour #FF5733 = Red:255, Green:87, Blue:51

Quick tip: Each hex digit = exactly 4 binary digits:

F = 1111, A = 1010, 3 = 0011
FA3₁₆ = 1111 1010 0011₂

Octal

Octal uses digits 0–7. Each octal digit = 3 binary digits.

Unix permissions: chmod 755

  • 7 = 111 (read+write+execute)
  • 5 = 101 (read+execute)
  • 5 = 101 (read+execute)

General conversion method

To convert between any two bases, go through decimal as an intermediate:

  1. Source → Decimal (positional multiplication)
  2. Decimal → Target (repeated division)

Or for binary↔hex/octal, use the grouping shortcut (group binary digits by 4 for hex, by 3 for octal).

Common values to memorise

DecimalBinaryHexOctal
0000000
81000810
101010A12
151111F17
16100001020
25511111111FF377

Convert any number between bases with our Number Base Converter — shows all bases simultaneously with step-by-step working.

#binary #hexadecimal #octal #decimal #number systems #CS
DC

OurDailyCalc Team

OurDailyCalc — beautiful tools for everyday calculations.