Binary, Decimal & Hex Converter
Computers fundamentally work in binary — a base-2 number system using only 0s and 1s — but binary numbers get long and hard to read quickly, which is why hexadecimal (base 16) shows up constantly in programming, color codes, memory addresses, and low-level debugging as a more compact stand-in. Decimal (base 10) is what humans normally think in day to day. Converting between these three number systems by hand is a common task for students learning computer science fundamentals, and for developers who need a quick sanity check without opening a full development environment. This converter takes a number in any one of the three bases and instantly shows its equivalent in the other two, so you can move fluidly between however a value is represented — a color hex code, a binary flag pattern, or a plain decimal number — without doing the positional-value math by hand every time.
How the Binary, Decimal & Hex Converter formula works
Every positional number system represents a value as a sum of digits multiplied by powers of its base:
Decimal value = Σ (digit × base^position), reading digits right to left starting at position 0
Binary uses base 2 (digits 0-1), decimal uses base 10 (digits 0-9), and hexadecimal uses base 16 (digits 0-9 then A-F representing 10-15). Converting into decimal uses the formula above directly; converting out of decimal into another base repeatedly divides by that base and reads the remainders in reverse order.
Step-by-step calculation
- To convert any base to decimal: multiply each digit by its base raised to its position (counting from 0 on the right), and sum the results.
- To convert decimal to another base: repeatedly divide the decimal number by the target base, recording each remainder.
- Reverse the order of the recorded remainders — that sequence is the number in the new base.
- For hexadecimal, remainders 10 through 15 are written as the letters A through F instead of two-digit numbers.
Worked example
Converting binary 11010 to decimal: (1×16) + (1×8) + (0×4) + (1×2) + (0×1) = 16+8+0+2+0 = 26. Converting 26 to hexadecimal: 26 ÷ 16 = 1 remainder 10 (A), then 1 ÷ 16 = 0 remainder 1 — reading remainders in reverse gives 1A.
Why hexadecimal exists, and where you'll actually run into these conversions
The practical reason hexadecimal is so widely used alongside binary comes down to a clean mathematical relationship: each hex digit represents exactly 4 binary digits (bits), since 16 is 2 to the 4th power. That means any binary number can be grouped into 4-bit chunks and directly translated to a single hex digit per chunk, with no complicated conversion math required once you know the mapping. An 8-bit binary number, unreadable at a glance as a string of eight 0s and 1s, becomes a tidy 2-digit hex value instead — which is exactly why hex shows up in contexts like memory addresses, binary file dumps, and low-level debugging output, where engineers need a human-scannable stand-in for raw binary data.
Color codes are probably the most common place a typical person encounters hexadecimal without necessarily thinking of it as a number base conversion. A web color like #3B82F6 is really three separate hex values (3B, 82, F6) representing the red, green, and blue intensity channels, each ranging from 00 to FF (0 to 255 in decimal) — so converting a hex color code into its decimal RGB components is a direct application of the same hex-to-decimal math this calculator performs. Similarly, MAC addresses, some cryptographic hashes, and many error codes in software are displayed in hexadecimal for the same compactness reason.
Binary itself remains the foundational representation because it maps directly onto the two physical states (on/off, high/low voltage) that digital electronics actually use at the hardware level — every value a computer stores or processes is, underneath any higher-level representation, ultimately binary. Understanding how to move fluidly between binary, hex, and decimal is a standard early topic in computer science education specifically because so much of what happens 'under the hood' in programming, networking, and digital logic design is easier to reason about once these conversions feel automatic rather than requiring a lookup table every time.
Frequently asked questions
Why does hexadecimal use letters A through F?
Hexadecimal is base 16, which needs 16 distinct single-character digits. After using 0 through 9 for the first ten values, the letters A through F are used to represent the remaining values 10 through 15, so every value can still be written as a single character per digit position.
How many bits does one hex digit represent?
Exactly 4 bits, since 2⁴ = 16 matches the base of the hexadecimal system — this is why hex is often used as a compact, readable stand-in for binary data.
Can this handle negative numbers?
This calculator handles non-negative whole numbers. Negative numbers in computing are typically represented using a scheme called two's complement, which is a separate, more involved topic beyond straightforward base conversion.
What's the largest value a given number of bits can represent?
An n-bit binary number can represent 2ⁿ distinct values, from 0 to 2ⁿ−1. For example, 8 bits (1 byte) can represent 256 values, from 0 to 255 — which is exactly the 00 to FF range seen in hex color codes.