Binary, Hex & Decimal Converter
Convert between binary, octal, decimal, and hexadecimal — supports custom bases from 2 to 36. Includes a bit visualization and automatic Roman numeral conversion.
Calculator verified • Last updated: August 2026
Bit Visualization
How Binary Numbers Work
Binary is a base-2 number system that uses only two digits: 0 and 1. Each position represents a power of 2, just like each position in decimal represents a power of 10 — in general, any base- number's value comes from summing each digit times a power of the base:
value: the number's equivalent value in decimal (base 10).
di: the digit at position i.
b: the base (radix) of the number system, such as 2 for binary or 16 for hexadecimal.
i: the digit's position, counting from 0 at the rightmost digit.
Computers use binary at the hardware level because transistors naturally represent two states — on and off — which map perfectly to 1 and 0.
How to Convert Decimal to Binary Manually
Repeatedly divide the decimal number by 2, recording the remainder each time, until the quotient reaches 0. For example, converting 13:
- 13 ÷ 2 = 6, remainder 1
- 6 ÷ 2 = 3, remainder 0
- 3 ÷ 2 = 1, remainder 1
- 1 ÷ 2 = 0, remainder 1 (stop — the quotient is now 0)
Reading the remainders in reverse order — from the last one calculated back to the first — gives 1101. That reversal is the key part: the last remainder you calculate becomes the first (leftmost) digit of the binary number.
Hexadecimal Explained — Why Programmers Use It
Hexadecimal (base 16) uses digits 0–9 and letters A–F to represent values 10–15. Its main advantage is that each hex digit maps exactly to 4 binary bits, so a full byte (8 bits) becomes just two hex digits — far easier to read and write than 8 individual 1s and 0s. That's why hex shows up in memory addresses, color codes, and byte dumps.
The Octal Number System
Octal (base 8) uses digits 0–7. It was more common in older computing systems where word sizes were multiples of 3 bits, and still appears today in contexts like Unix file permissions (e.g., chmod 755).
Worked Example: Decimal to Hexadecimal
Converting 250 to hex uses the same repeated-division method as binary, but dividing by 16 instead of 2: remainder , and remainder . In hex, 10 is written A and 15 is written F, so reading remainders bottom-up gives FA. Checking the reverse direction confirms it: .
Why a Byte Maxes Out at 255
A byte is 8 bits, and 8 binary digits can represent distinct values — 0 through 255. That's why 255 (binary 11111111, hex FF) shows up constantly in computing: it's the largest value a single byte can hold, which is why 8-bit color channels (like in RGB values) top out at 255, and why some counters or overflow bugs historically wrapped around at that number.
A Brief History of Number Bases
Most number systems throughout history used base 10, likely because humans have 10 fingers, but notable exceptions survive in everyday life: the Babylonians used base 60 roughly 4,000 years ago, which is why a circle has 360 degrees and an hour has 60 minutes. The Maya used base 20. Binary itself has a surprisingly old conceptual history — the ancient Chinese "I Ching" used binary-like sequences of broken and unbroken lines over 2,000 years ago, and German mathematician Gottfried Leibniz formally described the modern binary number system in 1703, partly inspired by his study of the I Ching. Binary didn't become practically important until the mid-20th century, when engineers building early computers realized that electronic circuits reliably distinguish only two states (voltage on or off), making binary the natural language of digital computing — a decision that then made hexadecimal and octal useful as compact human-readable shorthand for long binary strings.
Common Number Base Mistakes
Forgetting that place value works differently in each base — the "10s place" in binary represents 2, not 10 — leads to errors when converting by hand. Misreading hexadecimal letters (A through F represent 10 through 15) as if they were decimal digits is another common slip, especially when a hex value happens to also contain digits that look like a familiar decimal number. Dropping leading zeros when converting can also cause confusion in contexts like binary color codes or fixed-width byte representations, where the number of digits itself carries meaning.
Number Base Terms You Should Know
Base (or Radix) — the number of unique digits a number system uses, including zero; binary is base 2, decimal is base 10, hexadecimal is base 16.
Bit — a single binary digit, either 0 or 1, the smallest unit of digital information.
Nibble — 4 bits, exactly the amount needed to represent one hexadecimal digit.
Byte — 8 bits, the standard unit for representing a single character or small number in most computer systems.
Two's Complement — the standard method computers use to represent negative binary numbers, allowing addition and subtraction to use the same circuitry.
Frequently Asked Questions
Why do computers use binary?
Because transistors reliably represent only two states — on or off — which map directly to the binary digits 1 and 0.
What is hexadecimal used for?
Memory addresses, color codes, and byte-level data — because each hex digit maps to exactly 4 binary bits.
How do I convert binary to decimal by hand?
Multiply each digit by 2 raised to its position and sum the results. 1011 = 8+0+2+1 = 11.