Binary, Decimal & Hex Converter

Convert numbers between binary, decimal, hexadecimal, and octal instantly.

Understanding Number Bases

Computers fundamentally represent all data using binary (base 2) — sequences of 0s and 1s — because digital circuits are most reliably built from two-state (on/off) components. But binary is difficult for humans to read quickly, so programmers commonly use decimal (base 10, the everyday number system), hexadecimal (base 16), and occasionally octal (base 8) as more compact, human-readable representations of the same underlying binary data.

Why Hexadecimal Is So Common in Programming

Hexadecimal is popular because each hex digit maps to exactly 4 binary bits (a "nibble"), making conversion between binary and hex mechanically simple — far simpler than converting between binary and decimal. Hex digits run 0-9 then A-F (representing 10-15). This makes hex the standard format for representing memory addresses, color codes (like #FF5733 in CSS), byte values, and low-level data in programming and computer science generally.

How the Conversions Work

Each system represents the same quantity using a different "base" — the number of unique digits available before carrying over to the next place value. Binary has 2 digits (0-1), octal has 8 (0-7), decimal has 10 (0-9), and hexadecimal has 16 (0-9, A-F). The value 255 in decimal is 11111111 in binary (2⁷+2⁶+...+2⁰), FF in hex (15×16+15), and 377 in octal (3×64+7×8+7). All four represent the identical quantity — just written using different symbol systems.

Frequently Asked Questions

Why do computers use binary instead of decimal?

Digital electronic circuits are built from transistors that are most reliably operated as simple on/off switches — representing two states (0 and 1) is far more robust and less error-prone than trying to reliably distinguish ten different voltage levels for base 10.

What is a byte in relation to binary?

A byte is 8 binary digits (bits), capable of representing 256 distinct values (0-255 in decimal, or 00-FF in hex). This is why 255 (all 8 bits set to 1) is such a common reference value in programming — it represents the maximum value a single byte can hold.

When would I use octal instead of hex?

Octal is far less common today than hex, but it still appears in specific contexts like Unix/Linux file permission notation (e.g., chmod 755) and some older computing systems where word sizes were naturally divisible by 3 bits rather than 4.