Binary / Hex / Decimal Converter

Convert numbers between binary, decimal and hexadecimal.

How it works

Your input is first parsed in its source base, then re-expressed in the other two bases using standard positional-notation math.

Why computers think in binary but programmers write in hexadecimal

Computers use binary (base 2) at the hardware level for a straightforwardly practical reason: every value inside a computer is represented as an electrical signal, and distinguishing reliably between just two states — on and off, high voltage and low voltage — needs far less circuitry, space, energy and cost than building hardware that reliably distinguishes among ten or sixteen distinct voltage levels. Two clearly separated states also give a comfortable safety margin for reliability; a small voltage fluctuation is far less likely to be misread as the wrong value when there are only two possible states to confuse. This is a hardware-engineering decision, not a mathematical one — binary isn't inherently more "correct" for representing numbers, it's simply the most practical and reliable choice given how transistors and digital circuits physically work.

Hexadecimal (base 16) exists purely for human convenience — no computer hardware operates in base 16 directly, but programmers and engineers use it constantly because it maps perfectly onto binary in a way decimal doesn't: exactly 4 binary digits (bits) represent one hexadecimal digit, and since a byte is 8 bits, any byte can be written as exactly 2 hex digits. That means a value that needs 8 unwieldy binary digits (like 11100111) can be written far more compactly and readably as a 2-character hex value (E7), without losing the clean bit-level correspondence that makes converting back to binary trivial — unlike decimal, where converting to and from binary involves messier arithmetic with no such clean digit-for-digit relationship. That's exactly why memory addresses, color codes and low-level debugging output are almost universally shown in hex rather than decimal or raw binary.

Frequently asked questions

Why do computers use binary instead of decimal at the hardware level?

Because every value in a computer is represented by electrical signals, and reliably distinguishing just two states (on/off, high/low voltage) requires far less circuitry, space and energy than building hardware that reliably distinguishes among ten distinct voltage levels for decimal. It's a practical hardware-engineering choice, not a claim that binary is mathematically superior for representing numbers.

If computers use binary, why do programmers work in hexadecimal?

Because hexadecimal maps perfectly onto binary in a way decimal doesn't — exactly 4 binary digits equal one hex digit, and since a byte is 8 bits, any byte converts cleanly to exactly 2 hex digits. This makes hex far more compact and readable than raw binary while keeping a simple, direct digit-for-digit relationship that decimal-to-binary conversion doesn't have.

How many binary digits does one hexadecimal digit represent?

Exactly 4 binary digits (bits) per hexadecimal digit, which is why a single byte (8 bits) always converts to exactly 2 hex digits — for example, the 8-bit binary value 11100111 converts directly to the 2-character hex value E7, a much shorter and more readable representation of the identical value.

Where do you actually encounter hexadecimal in everyday computing?

Memory addresses, web color codes (like #FF5733), MAC addresses, and low-level debugging or error output are almost universally shown in hexadecimal rather than decimal or binary, precisely because of its compact, clean correspondence to the underlying binary data that a decimal representation wouldn't preserve as neatly.

Related calculators