Add, subtract, multiply and divide hexadecimal numbers with carries and borrows done for you, convert between hex, decimal, binary and octal in one place, and decode hex colors such as FF5733 into their red, green and blue parts.
Hexadecimal, hex for short, is a way of writing numbers with sixteen digits instead
of the ten that everyday decimal uses. Digits 0 through 9 keep their usual values, and the
letters A through F stand in for ten through fifteen: A is 10, B is 11, and F is 15. Case
never matters, so ff and FF are the same number.
What makes hex special is not the base itself but its relationship with binary. Every hex digit corresponds to exactly four binary digits, a group computer engineers call a nibble. F is 1111, A is 1010, and the correspondence is exact, which is the whole reason hex exists, as the next section explains.
Computers store everything in binary, but long binary strings are unreadable: the byte 11111111 is hard to take in at a glance. Because 16 is the fourth power of 2, each hex digit packs four binary digits, so the same byte reads simply as FF. Two hex digits always describe one byte, which runs from 00 to FF, that is, 0 to 255.
That compression without any loss of structure is why hex shows up everywhere in computing: memory addresses, color codes, error codes, file signatures and hardware identifiers are all written in hex, because a technician can glance at two hex digits and know exactly which bits are set.
Hex place values are powers of sixteen, counted from the right: 1, 16, 256, 4096. To read a hex number, multiply each digit by its place value and add. Take 1A:
1A = (1 × 16) + (A × 1) = 16 + 10 = 26
the letter A contributes 10, so 1A is twenty-six in decimal
A longer example, 2AA: (2 × 256) + (10 × 16) + (10 × 1) = 512 + 160 + 10 = 682. Reading hex to decimal is nothing more than that sum, and the calculator's breakdown table performs it digit by digit for any value you enter.
Hex addition and subtraction follow the same column rules as decimal arithmetic, with one difference: a column is full at fifteen, not nine. Adding FF + 1: the right column holds 15 + 1 = 16, which is one group of sixteen with 0 left over, so write 0 and carry 1. The next column then holds 15 + 1 = 16 again, write 0, carry 1. The result is 100, and in decimal it reads 255 + 1 = 256. That single example shows both the carry rule and why FF is the largest value one byte can hold.
Borrowing in subtraction takes sixteen, not ten. Compute 5DC - 3AF: the right column has C (12) minus F (15), which is too small, so borrow: 16 + 12 - 15 = 13, which is D. The middle column, reduced by the borrow, gives C (12) - A (10) = 2, and the left column 5 - 3 = 2, for a result of 22D. In decimal, 1500 - 943 = 557, and 557 is 22D in hex. The calculator performs every operation in decimal behind the scenes and shows that line, so you can check hand work column by column.
Division works like long division, and this calculator reports a quotient and a remainder rather than a fraction, the way integer division works in programming languages. A subtraction that would go below zero is stopped with a message instead of a negative result, since hex here describes unsigned byte-style values.
The four bases in the conversion tool are related by powers of two, which makes three of the four conversions nearly mechanical:
Check it against the place values: 5DC = (5 × 256) + (13 × 16) + 12 = 1280 + 208 + 12 = 1500. The conversion tool runs every direction instantly and shows all four forms of whatever you type.
The 0x prefix you often see simply announces "the digits after this are hex",
so 0x1A and 1A are the same number, twenty-six.
Base 16 needs sixteen distinct digits, but our numeral symbols only run from 0 to 9. The letters A through F fill the gap, with A equal to ten and F equal to fifteen. They are single digits, not variables, and in hex a value like 1F means one sixteen plus fifteen, which is thirty-one.
A nibble is four binary digits, half of an eight-bit byte. It is the natural unit of hex, because one hex digit stores exactly one nibble: 0 through F covers every combination of four bits. A byte is therefore always exactly two hex digits, which is why hex and binary convert with no arithmetic at all.
Divide by 16 and collect remainders. Take 1500: dividing by 16 leaves remainder 12, which is the hex digit C; dividing the quotient 93 by 16 leaves remainder 13, which is D; and the final quotient is 5. Reading the collected digits from last to first gives 5DC. The conversion tool shows all four bases so you can check any hand conversion instantly.
Binary is exact but unreadable at length, and decimal hides the bit structure. Hex is the compromise: it is four times shorter than binary, and each digit maps cleanly to four bits, so a programmer can see which individual bits are set while reading a compact number. That is why memory dumps, color codes and machine-level documentation are all written in hex.
A byte holds eight bits, and eight bits make two hex digits. The largest two-digit hex number is FF, and FF equals 255 in decimal, which is also the largest value eight bits can hold. Add one and the byte overflows to 100 in hex, which is why FF + 1 = 100 is the classic demonstration of a carry in base 16.
It is a prefix that marks the following digits as hexadecimal, used in programming languages so that 0x10 is unambiguously sixteen rather than ten. CSS uses a different marker: the # in #FF5733. This calculator accepts the digits with or without a hash in the color tool, and plain digits everywhere else.
Hex arithmetic in computing is usually integer arithmetic, and processors report division as a quotient plus a remainder. FACE divided by 11, for example, gives quotient EC0 with remainder E, because 64206 divided by 17 is 3776 with 14 left over. If you need a fractional answer, read the decimal values from the conversions table and divide those, then convert back if you need to.
No. Every calculation runs in your browser. Nothing is stored or transmitted.