386+ Tools Comprehensive Tools for Webmasters, Developers & Site Optimization

Number Base Converter - Binary, Decimal, Octal, Hexadecimal Converter

Number Base Converter

Convert between binary, decimal, octal, and hexadecimal.


Understanding Number Systems

A number system (or numeral system) is a writing system for expressing numbers. Different number systems use different bases, which represent how many unique digits are used to represent numbers. The most common systems are binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16).

Decimal (Base 10)

The decimal system is what we use in everyday life. It uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Each position represents a power of 10.

Example: 365 = (3 × 10²) + (6 × 10¹) + (5 × 10⁰)

= (3 × 100) + (6 × 10) + (5 × 1) = 300 + 60 + 5

Binary (Base 2)

Binary uses only two digits: 0 and 1. It's the foundation of all digital computers and electronics. Each position represents a power of 2.

Example: 1011₂ = (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰)

= (1 × 8) + (0 × 4) + (1 × 2) + (1 × 1) = 8 + 0 + 2 + 1 = 11₁₀

Why Computers Use Binary

  • Simple electronics: On/off, high/low voltage states
  • Reliable: Easy to distinguish between two states
  • Fast operations: Simple logic gates
  • Error detection: Easier to detect transmission errors

Octal (Base 8)

Octal uses eight digits: 0, 1, 2, 3, 4, 5, 6, 7. Each position represents a power of 8. It was popular in early computing as a shorthand for binary (3 binary digits = 1 octal digit).

Example: 75₈ = (7 × 8¹) + (5 × 8⁰)

= (7 × 8) + (5 × 1) = 56 + 5 = 61₁₀

Hexadecimal (Base 16)

Hexadecimal uses sixteen digits: 0-9 and A-F (where A=10, B=11, C=12, D=13, E=14, F=15). Each position represents a power of 16. It's commonly used in computing because 4 binary digits = 1 hex digit.

Example: 2F₁₆ = (2 × 16¹) + (15 × 16⁰)

= (2 × 16) + (15 × 1) = 32 + 15 = 47₁₀

Conversion Table

Decimal Binary Octal Hexadecimal
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F
16100002010

Real-World Applications

Programming and Computer Science

  • Memory addresses: Often displayed in hexadecimal
  • Colors: RGB colors in hex (#FF5733 = Red: FF, Green: 57, Blue: 33)
  • File permissions: Unix/Linux uses octal (755, 644)
  • IP addresses: IPv6 uses hexadecimal
  • Binary data: File formats, network protocols

Web Development

Color Codes: CSS uses hexadecimal for colors
#FF0000 = Red (FF=255 red, 00=0 green, 00=0 blue)
#00FF00 = Green
#0000FF = Blue

Networking

MAC addresses use hexadecimal: 00:1A:2B:3C:4D:5E

IPv6 addresses use hexadecimal: 2001:0db8:85a3:0000:0000:8a2e:0370:7334

Quick Conversion Methods

Binary to Hexadecimal

Group binary digits into sets of 4, starting from the right:

Example: 11010110₂

Group: 1101 0110

Convert: D 6 = D6₁₆

Hexadecimal to Binary

Convert each hex digit to 4 binary digits:

Example: A3₁₆

A = 1010, 3 = 0011

Result: 10100011₂

Common Programming Prefixes

Base Prefix Example
Binary0b0b1010 = 10
Octal0o or 00o12 = 10
DecimalNone10 = 10
Hexadecimal0x0xA = 10

Binary Operations

Understanding binary is essential for bitwise operations in programming:

  • AND (&): Both bits must be 1
  • OR (|): At least one bit must be 1
  • XOR (^): Bits must be different
  • NOT (~): Inverts all bits
  • Shift (<<, >>): Moves bits left or right
Tip: When working with large binary numbers, use hexadecimal as shorthand. It's much easier to read 0xFF than 11111111.
Powers Reference

Binary (Base 2):

  • 2⁰ = 1
  • 2¹ = 2
  • 2² = 4
  • 2³ = 8
  • 2⁴ = 16
  • 2⁵ = 32
  • 2⁶ = 64
  • 2⁷ = 128
  • 2⁸ = 256

Hexadecimal (Base 16):

  • 16¹ = 16
  • 16² = 256
  • 16³ = 4,096
Hex Digits
  • A = 10
  • B = 11
  • C = 12
  • D = 13
  • E = 14
  • F = 15