๐Ÿ‡บ๐Ÿ‡ธ USC
Math & Conversion
๐Ÿ”ฃ

Hex Calculator

Add, subtract, multiply and convert hexadecimal numbers

โœ…

Last updated September 6, 2026

Method: Conversions use exact positional notation, where each digit is multiplied by 16 raised to its position. Arithmetic is carried out on the exact integer values and the answer is rendered back into hexadecimal, decimal, binary and octal. These are exact definitions of the number bases, not approximations.

Included: Hex addition, subtraction, multiplication and integer division with remainder; two-way conversion between hexadecimal, decimal, binary and octal; a place-value breakdown, a repeated-division table, and a complete decimal 0 to 255 conversion table.

Not included: Negative values, two's-complement or signed-register arithmetic, hex fractions, floating-point hex literals, and values above JavaScript's exact-integer limit of 9,007,199,254,740,991.

What do you want to do?

Hexadecimal arithmetic

Enter two hex numbers using the digits 0-9 and the letters A-F. A leading 0x or # is ignored.

First hex number
0x

Equals 755 in decimal.

Operation
Second hex number
0x

Equals 424 in decimal.

Result in hexadecimal

49Bbase 16
Decimal (base 10)
1,179
Octal (base 8)
2233
Binary (base 2)
0100 1001 1011
The same calculation in decimal
755 + 424 = 1,179

Step by step

  1. Expand each hex number by place value: 2F3 is 755 and 1A8 is 424.
  2. Apply the operation to those values: 755 + 424 = 1,179.
  3. Convert the answer back to base 16 by dividing by 16 over and over and reading the remainders from the bottom row up.
DivideQuotientRemainderHex digit
1,179 / 167311B
73 / 16499
4 / 16044
Remainders read bottom to top49B

Works with unsigned (non-negative) whole numbers. Division is integer division and shows a separate remainder. Results are exact up to 9,007,199,254,740,991 (2^53 - 1), which covers 13 hex digits.

Hex calculator: hexadecimal arithmetic and instant base conversion

A hex calculator does arithmetic directly in base 16 and converts any value between hexadecimal, decimal, binary and octal. Hexadecimal uses sixteen digits: 0 through 9 and then A through F for the values 10 to 15. Add 2F3 and 1A8 and you get 49B, which is 755 + 424 = 1,179 in decimal. Type any two values above to see it worked out.

Working in base 2 instead? The Binary Calculator is the bit-level twin of this page: it treats binary as the primary input, shows a bit-by-bit place-value table and performs binary column arithmetic. Use this hex page when you are typing values such as 0x1F, a memory address or a color code; use the binary page when you are reading raw bits, masks or flags. Both tools convert into all four bases, so nothing is lost either way.

What hexadecimal actually is

Every number system is defined by its base, meaning how many symbols it has before it rolls over into a new column. Decimal is base 10, so it rolls over at ten. Hexadecimal is base 16, so it rolls over at sixteen. In decimal the columns are worth 1, 10, 100 and 1,000; in hex they are worth 1, 16, 256 and 4,096. That is the entire difference, and every conversion rule follows from it.

Because sixteen symbols are needed and decimal numerals stop at 9, the first six letters of the alphabet are pressed into service. A means 10, B means 11, C means 12, D means 13, E means 14 and F means 15. So the two-character value FF is not "double F"; it is (15 x 16) + 15 = 255, which is exactly the number of values a single 8-bit byte can hold above zero.

The formula behind every hex conversion

Converting hex to decimal is one line of positional arithmetic. For a hex value with digits d written from right to left:

Decimal = d0 × 160 + d1 × 161 + d2 × 162 + …

Going the other way, from decimal to hex, you divide instead of multiply. Divide the decimal number by 16, note the remainder, then divide the quotient by 16 again, and keep going until the quotient is zero. Reading the remainders from the last one back to the first spells the hex value:

n ÷ 16 → quotient + remainder, repeat until quotient = 0

The calculator prints that division table for you every time it produces a hex answer, so you can check the work by hand rather than trusting a black box.

The sixteen hex digits

This is the whole alphabet of base 16. Each digit is also shown as its four-bit binary pattern, because one hex digit is always exactly four bits, and as its octal form for completeness.

Hex digit Decimal Binary (4 bits) Octal
0000000
1100011
2200102
3300113
4401004
5501015
6601106
7701117
88100010
99100111
A10101012
B11101113
C12110014
D13110115
E14111016
F15111117

Learn these sixteen rows and most hex work becomes mental arithmetic. The pattern that trips people up is the jump from 9 to A, because that is where the symbols stop looking like numbers even though nothing special is happening mathematically.

Hex place values

The column weights are powers of 16, so they grow far faster than decimal columns. The last column shows the largest amount a single digit can contribute at that position, which is always 15 times the place value.

Position Power Place value Max from digit F
0160115
116116240
21622563,840
31634,09661,440
416465,536983,040
51651,048,57615,728,640
616616,777,216251,658,240
7167268,435,4564,026,531,840

Worked example: 2F3 + 1A8 in hex

Start by expanding both values with the place-value formula. For 2F3: the digit 2 sits in the 256s column and contributes 512, the digit F sits in the sixteens column and contributes 15 x 16 = 240, and the digit 3 in the ones column contributes 3. Adding those gives 512 + 240 + 3 = 755. For 1A8: 1 x 256 = 256, A x 16 = 10 x 16 = 160, and 8 x 1 = 8, so the total is 424.

Now add them in decimal: 755 + 424 = 1,179. To turn 1,179 back into hex, divide repeatedly by 16. 1,179 divided by 16 is 73 remainder 11, and 11 is the digit B. 73 divided by 16 is 4 remainder 9. 4 divided by 16 is 0 remainder 4. Reading the remainders bottom to top gives 49B.

You can also add the columns directly in hex without ever visiting decimal, which is how experienced programmers do it. The ones column is 3 + 8 = 11, written B. The sixteens column is F + A = 15 + 10 = 25, and because 25 is 16 + 9, you write 9 and carry 1. The 256s column is 2 + 1 plus the carry of 1, which is 4. Same answer: 49B. Change the operation to subtraction and the tool returns 14B (755 - 424 = 331); multiplication gives 4E278 (320,120); and division gives 1 with a remainder of 14B.

Second worked example: reading a hex color code

A six-digit web color such as #1E90FF is really three separate hex-to-decimal conversions bolted together, one per color channel. Split it into pairs: 1E, 90 and FF. The first pair is (1 x 16) + 14 = 30 red. The second is (9 x 16) + 0 = 144 green. The third is (15 x 16) + 15 = 255 blue. So the color is rgb(30, 144, 255), a strong blue.

Two hex digits cover exactly one byte, so each channel runs from 00 to FF, that is 0 to 255, giving 256 levels per channel. Three channels multiply out to 256 x 256 x 256 = 16,777,216 distinct colors, the familiar "16.7 million colors" figure, and the largest six-digit hex value FFFFFF is 16,777,215 because counting starts at zero. Paste any pair into the converter above and the decimal channel value appears immediately.

Hex arithmetic examples at a glance

Every row below was produced with the same method the calculator uses: expand to exact integers, apply the operation, convert back to base 16. Division is integer division, so a remainder is listed separately where one exists.

Hex pair In decimal Sum Difference Product Quotient
A & 510 & 5F5322
FF & 1255 & 1100FEFFFF
2B & 1A43 & 26451145E1 r 11
2F3 & 1A8755 & 42449B14B4E2781 r 14B
DEF & ABC3,567 & 2,74818AB3339591841 r 333
FFFF & FF65,535 & 255100FEFF00FEFF01101

Notice the last row: FFFF divided by FF is exactly 101 in hex, because 65,535 divided by 255 is 257 and 257 in base 16 is 101. Clean divisions like that are common in hex precisely because the base is a power of two.

Common decimal values in hex, binary and octal

These are the landmark values worth memorizing. They show up constantly in memory sizes, register limits and color channels.

Decimal Hex Binary Octal
10A101012
15F111117
16101000020
322010000040
64401000000100
100641100100144
1288010000000200
200C811001000310
255FF11111111377
256100100000000400
1,0003E811111010001750
1,024400100000000002000
4,095FFF1111111111117777
4,0961000100000000000010000
65,535FFFF1111111111111111177777
1,048,5761000001000000000000000000004000000
16,777,215FFFFFF11111111111111111111111177777777

Two patterns are worth spotting. Powers of 16 are always a 1 followed by zeros in hex, so 4,096 is 1000 and 1,048,576 is 100000. And a run of F digits is always one less than the next power of 16, which is why FF is 255, FFF is 4,095 and FFFF is 65,535.

How to use this hex calculator

The tool has three modes and each one answers a different question. Work through them in whatever order suits the job in front of you:

  1. Hex math: type two hexadecimal values, choose +, -, x or /, and read the answer in hex. A leading 0x or # is stripped automatically, and each input shows its decimal value underneath so you can sanity-check what you typed.
  2. Convert: type into any of the four fields (hexadecimal, decimal, binary, octal) and the other three rewrite themselves instantly. The place-value table under the result shows exactly how the hex digits add up.
  3. Table: browse the complete decimal 0 to 255 reference with hex and 8-bit binary side by side, plus a card for each of the sixteen hex digits.

Everything recalculates as you type; there is no submit button and nothing is sent to a server. If you enter a character that is not a legal digit for that base, the calculator says so instead of quietly returning a wrong answer.

Who this calculator is for

  • Programmers reading memory addresses, bit masks, error codes and register values, all of which are conventionally written in hex.
  • Students in a computer science, digital logic or electronics course who need to show the conversion steps, not just the answer.
  • Web designers translating between hex color codes and RGB values.
  • Network and IT staff decoding MAC addresses, IPv6 segments and checksums, which are written as hex byte pairs.
  • Hardware and firmware engineers setting configuration registers where the datasheet lists everything in hex.
  • Anyone who has hit an unfamiliar 0x value in a log file and just wants to know what number it is.

Why hexadecimal exists at all

Computers work in binary, but binary is painful for humans to read. A single 32-bit value takes 32 characters of 1s and 0s, and miscounting one position silently changes the number. Because 16 is 2 to the fourth power, one hex digit always stands for exactly four bits, so the same 32-bit value fits into eight hex characters with a mechanical, error-free translation in either direction. Hex is not a different way of storing data; it is a compact way of writing binary down.

That is why hex, not decimal, is the notation of choice wherever the underlying bits matter: memory addresses, MAC addresses, IPv6 addresses, character encodings such as UTF-8 byte sequences, checksums and hash digests, machine-code bytes, and color channels. Octal, base 8, plays the same role for groups of three bits and survives mainly in Unix file permissions.

Hex subtraction and borrowing

Hex subtraction works like decimal subtraction, except a borrow is worth 16 rather than 10. Take 502 - 1A9. In the ones column 2 is smaller than 9, so borrow from the sixteens column: 2 becomes 18 (that is 2 + 16), and 18 - 9 = 9. The sixteens column has been reduced from 0 to a borrowed value, so borrow again from the 256s column: it becomes 15 (F) and F - A = 5. The 256s column is now 4, and 4 - 1 = 3. The answer is 359, and checking in decimal, 1,282 - 425 = 857, which is indeed 359 in hex.

Because this calculator uses unsigned values, it asks you to put the larger number first. If you need the magnitude of a difference that would go negative, swap the operands and note the sign yourself.

Hex multiplication and division

Multiplication in hex is where most people stop doing it by hand, because it needs a 16 by 16 times table rather than a 10 by 10 one. The calculator handles it by multiplying the exact integer values and converting back: for example A x 5 is 50 in decimal, which is 32 in hex, and 2F3 x 1A8 is 320,120, which is 4E278.

Division is integer division. Dividing 2B by 1A gives a quotient of 1 with a remainder of 11 in hex, because 43 divided by 26 is 1 remainder 17, and 17 in hex is 11. Both parts are shown separately so nothing is silently rounded. If you need the fractional result instead, convert to decimal first and divide there.

Key terms

  • Base (radix): how many symbols a number system uses before adding a column. Hex is base 16.
  • Nibble: four bits, exactly one hex digit, holding a value from 0 to 15.
  • Byte: eight bits, exactly two hex digits, holding a value from 0 to 255 (00 to FF).
  • Word: the natural unit a processor works on, commonly 16, 32 or 64 bits, written as 4, 8 or 16 hex digits.
  • Most significant digit: the leftmost digit, carrying the largest place value.
  • 0x prefix: the notation that marks a literal as hexadecimal in most programming languages.
  • Unsigned: a value that has no sign bit and therefore cannot be negative, which is what this calculator uses.

What changes the result

  • Digit position: moving a digit one column to the left multiplies its contribution by 16, so a stray character changes the value dramatically.
  • Letter digits: mistaking B for 8 or D for 0 is the most common transcription error and shifts the result by a large amount.
  • Base assumption: the string 20 is 32 if it is hex and 20 if it is decimal. Always know which base you are reading.
  • Leading zeros: they never change the value (0F equals F) but they do fix the width, which matters when a field is defined as one byte.
  • Integer division: the quotient alone loses information; the remainder is the rest of the answer.

Tips for reading hex quickly

  • Anchor on three values: F is 15, FF is 255 and FFFF is 65,535. Most quick estimates hang off those.
  • Count hex digits in pairs. Each pair is one byte, so an eight-digit value is four bytes, which is a 32-bit word.
  • To halve a hex number, halve it in binary: shifting right by one bit divides by two, and shifting by four bits drops a whole hex digit.
  • A hex value ending in 0 is divisible by 16; ending in 00 means divisible by 256.
  • When a value looks suspiciously round, such as 1000 or 8000, check the powers-of-16 table above before assuming it is decimal.

Limitations and assumptions

  • All values are treated as unsigned whole numbers. Negative results, sign bits and two's-complement wraparound are not modeled.
  • There is no fixed register width. Real 8-bit or 32-bit hardware would wrap or overflow where this calculator simply produces a longer number.
  • Hex fractions (digits after a hex point) and hexadecimal floating-point literals are out of scope.
  • Results are exact only up to 9,007,199,254,740,991, the largest integer standard JavaScript numbers represent without loss. Larger inputs are rejected rather than rounded.
  • Division is integer division with a separate remainder, not a decimal quotient.

How it compares to related calculators

This page answers "what is this hex value, and what happens when I do arithmetic on it?" For a neighboring question, a sister tool fits better:

Sources

Everything on this page is deterministic mathematics that follows from the definition of a positional number system, so no external data source is required and none is cited. Base conversion, hex addition, subtraction, multiplication and integer division are exact operations with a single correct answer, and every worked example above was computed rather than estimated. The byte-based landmarks shown here, such as FF for 255 and FFFF for 65,535, follow directly from 8-bit and 16-bit field widths rather than from any published table, so they can be re-derived from the place-value formula above at any time. If you want to check a row by hand, expand the hex digits by their powers of 16 and compare; every value on this page will reproduce exactly.

โš ๏ธ Common mistakes & edge cases

Reading a hex string as decimal

The value 64 in hex is 100, not sixty-four. Decimal 64 is written 40 in hex. Whenever a number could be either, check for a 0x or # prefix, or for the presence of a letter digit, before you act on it.

Forgetting that A to F are digits, not units

F is the single digit fifteen, not "F units of something". So FF is (15 x 16) + 15 = 255, not 15 and not 1,515. Every letter behaves exactly like a numeral in the place-value formula.

Carrying at 10 instead of 16

In hex addition a column only carries once it reaches 16. Adding F + A gives 25, which is written as 9 with a carry of 1, not as 25 or as 15. Carrying too early is the single most common hand-arithmetic error in base 16.

Dropping the remainder in division

Integer division answers "how many whole times does it fit?" Dividing 2F3 by 1A8 gives 1, but the remainder 14B is most of the value. Always read both numbers, or convert to decimal if you need a fractional answer.

Assuming a fixed register width

On 8-bit hardware FF + 1 wraps around to 00. This calculator has no width limit, so it reports 100 instead. If you are modeling a specific register, apply the wraparound yourself.

Splitting a color code in the wrong places

A six-digit color is three pairs, not two triples. #1E90FF is 1E, 90 and FF, giving 30, 144 and 255. Splitting it as 1E9 and 0FF produces two numbers that mean nothing.

Note: Every result here is exact integer arithmetic on unsigned values. It does not simulate a specific processor, register width or overflow behavior.

❓ Frequently asked questions

How do you convert hex to decimal?

Multiply each hex digit by its place value, which is a power of 16, and add the results. Reading right to left the places are 1, 16, 256, 4,096 and so on, and the letters A to F count as 10 to 15. For example 2F3 = (2 x 256) + (15 x 16) + (3 x 1) = 512 + 240 + 3 = 755. The converter above shows this place-value breakdown for any hex value you type.

How do you convert decimal to hex?

Divide the decimal number by 16 over and over, writing down each remainder, then read the remainders from the last one back to the first. For example 755 divided by 16 is 47 remainder 3, 47 divided by 16 is 2 remainder 15 (the digit F), and 2 divided by 16 is 0 remainder 2, giving 2F3. Type 755 into the decimal field and the hex appears instantly, together with the division table.

How does hex addition work?

Hex addition uses the same column method as decimal, but a column carries when it reaches 16 rather than 10. For example 2F3 + 1A8: the ones column is 3 + 8 = 11, which is B; the sixteens column is 15 + 10 = 25, which is 9 with a carry of 1; the 256s column is 2 + 1 + 1 = 4. The answer is 49B, and in decimal that is 755 + 424 = 1,179.

Can this hex calculator subtract, multiply and divide?

Yes. Choose the Hex math mode, enter two hex values and pick +, -, x or /. Subtraction requires the first value to be greater than or equal to the second because the tool uses unsigned, non-negative numbers. Division is integer division, so it returns a whole-number quotient plus a separate remainder, and both are shown in hex and in decimal.

Why does hexadecimal use the letters A to F?

Base 16 needs sixteen distinct digit symbols, but our numerals only go from 0 to 9. The letters A, B, C, D, E and F fill the last six slots and stand for the values 10, 11, 12, 13, 14 and 15. So FF means (15 x 16) + 15 = 255, the largest value a single byte can hold.

What is FF in decimal?

FF equals 255. Work it out by place value: F is 15, so FF = (15 x 16) + (15 x 1) = 240 + 15 = 255. That is the maximum value of one 8-bit byte, which is why color channels, brightness levels and many hardware registers top out at FF. In binary FF is 11111111 and in octal it is 377.

Why do programmers write 0x before a hex number?

The 0x prefix is a convention that tells a compiler or a reader that the digits are base 16 rather than base 10. Without it, 10 could mean ten or sixteen. Other notations exist too: HTML and CSS colors use a leading #, some assemblers use a trailing h, and older systems used a dollar sign. This calculator accepts a leading 0x or # and simply ignores it.

How do I convert hex to binary by hand?

Replace every hex digit with its four-bit pattern and join them together. A is 1010, F is 1111, 3 is 0011, and so on. So 2F3 becomes 0010 1111 0011. This works because 16 equals 2 to the fourth power, so one hex digit is always exactly four bits. Going the other way, group the bits into fours from the right and convert each group to one hex digit.

What does a hex color code like #1E90FF mean?

A six-digit hex color splits into three pairs, one each for red, green and blue. In #1E90FF, 1E is 30, 90 is 144 and FF is 255, so the color is 30 red, 144 green and 255 blue - a bright blue. Each pair covers 0 to 255 because two hex digits hold exactly one byte, which gives 256 levels per channel and 16,777,216 possible colors in total.

Is the hex calculator the same as a binary calculator?

They are close relatives working in different bases. This page is hex-first: hexadecimal arithmetic, a hex place-value breakdown and a decimal 0 to 255 table. The Binary Calculator is base-2-first, with bit-level place values and binary column arithmetic. Both convert between binary, octal, decimal and hex, so pick the one that matches the base you are actually typing.

What is the largest number this hex calculator handles?

Calculations use standard JavaScript numbers, which are exact for whole numbers up to 9,007,199,254,740,991, that is 2 to the 53rd power minus 1. In hex that covers values up to 13 digits long. Anything larger is rejected rather than shown with a silent rounding error, so every result you see on screen is exact.

Does this calculator handle negative hex numbers or two's complement?

No. It works with unsigned, non-negative whole numbers so that the place-value tables and the division steps stay easy to follow. It does not model two's-complement negatives, signed 8-bit or 32-bit registers, or hex fractions with digits after a hex point. For everyday conversion and integer arithmetic that covers almost every case.

Why is one hex digit exactly four bits?

Because 16 = 2^4. Each additional binary digit doubles the range, so four bits give 2 x 2 x 2 x 2 = 16 combinations, exactly the number of symbols base 16 needs. That one-to-one match is the whole reason hex exists as a shorthand: a 32-bit value that takes 32 characters in binary fits into 8 hex digits with no arithmetic required to translate between them.

What is 0x64 in decimal?

0x64 equals 100. The place values are 16 and 1, so 0x64 = (6 x 16) + (4 x 1) = 96 + 4 = 100. Be careful not to read the digits as the decimal number sixty-four: in hex the string 64 is one hundred, while decimal 64 is written 40 in hex. Typing either value into the converter above settles it instantly.

๐Ÿ’ก Good to know

Two hex digits are always exactly one byte

That single fact explains most hex you will ever meet. A MAC address is six byte pairs, an IPv4 address in hex is four, a 32-bit register is four, and a color code is three. Counting characters in pairs tells you the size of the field at a glance.

Case does not change the value

0xFF, 0xff and 0xFf are the same number. Uppercase is the common convention for constants and lowercase for addresses, but no compiler or converter cares. This tool displays hex in uppercase for readability and accepts either form as input.

Hex and binary translate without arithmetic

Because one hex digit is four bits, you can convert in either direction purely by substitution: 3 becomes 0011, F becomes 1111. Decimal has no such shortcut, which is exactly why hex became the working notation for anything close to the hardware.

Related Calculators