Binary & Hex Converter

Convert between binary, hex, decimal and octal numbers.

Enter values above to see results ✦

📖 How Binary & Hex Converter Works

Understanding different numeral systems is a cornerstone of computer science and digital logic. This Base Converter allows you to bridge the gap between human-readable decimal numbers and the binary, hexadecimal, and octal formats used by hardware, low-level programming, and networking.

Common Number Bases

Value = Σ (digit × baseᵖᵒˢⁱᵗⁱᵒⁿ)
  • Decimal (Base 10): The standard system used by humans day to day. Uses digits 0–9.
  • Binary (Base 2): The native language of computer hardware, where every value is stored as electrical on/off states. Uses only 0 and 1.
  • Hexadecimal (Base 16): A compact way to represent binary. Uses digits 0–9 and letters A–F, where A=10 through F=15.
  • Octal (Base 8): Less common today, but still used in some legacy systems and Unix/Linux file permission notation (like chmod 755).

Worked Example

The decimal number 255 converts to binary 11111111 (eight 1s, since 255 is the maximum value a single byte can hold), to hexadecimal FF (F=15, and 15×16 + 15 = 255), and to octal 377. This is exactly why 255 shows up constantly in computing — it's the largest value representable in 8 bits.

Why Use Hexadecimal?

Hexadecimal is preferred in programming because one hex digit corresponds exactly to 4 bits (a "nibble"), and two hex digits correspond exactly to one byte (8 bits). This makes it significantly easier to read memory addresses, color codes (like #FF5733 in CSS), and MAC addresses than the equivalent raw binary string, which would be four times longer and much harder to scan visually.

Practical Applications

  • Web development: CSS colors are written in hexadecimal (e.g., #FFFFFF for white).
  • Networking: IPv6 addresses and MAC addresses are expressed in hexadecimal.
  • Low-level programming: Memory addresses, byte values, and bitwise flags are commonly shown in hex or binary.
  • Unix/Linux permissions: File permission codes like 755 or 644 are octal representations of read/write/execute bits.
❓ How do I convert manually?

To convert from decimal to another base, repeatedly divide the number by the target base and record the remainders in reverse order. To convert to decimal, multiply each digit by the base raised to its positional power (starting at 0 from the right) and sum the results.

❓ Why does binary use so many more digits than decimal?

Because binary only has two symbols (0 and 1) per digit compared to decimal's ten (0–9), it needs roughly 3.3 times more digits to represent the same value — which is exactly why hexadecimal exists, as a much more compact stand-in for binary.