Hex Calculator

Modify the values and click the calculate button to use

Hexadecimal Calculation—Add, Subtract, Multiply, or Divide

= ?

Convert Hexadecimal Value to Decimal Value

Hexadecimal Value: = ?

Convert Decimal Value to Hexadecimal Value

Decimal Value: = ?

RelatedBinary Calculator | IP Subnet Calculator

The hexadecimal numeral system operates in a way that mirrors both decimal and binary systems. While decimal uses a base of ten and binary a base of two, hexadecimal works with a base of sixteen. It utilizes sixteen symbols – the digits 0‑9 and the letters A through F (a‑f) to denote the values ten to fifteen. Each hex digit represents a quartet of binary bits (a nibble), which makes long binary strings easier to read. For example, the binary pattern 1010101010 can be condensed into the hex value 2AA.

Below are some typical conversions between hex, binary, and decimal values:


Hex/Decimal Conversion

HexBinaryDecimal
000
111
2102
3113
41004
51015
61106
71117
810008
910019
A101010
B101111
C110012
D110113
E111014
F111115
141010020
3F11111163

Switching between decimal and hexadecimal requires a grasp of the respective place‑value systems. A deeper dive can be found on the binary calculator page. The conversion process is much like moving between decimal and binary; mastering one simplifies the other. Since hex is based on sixteen, each position in a number such as 2AA corresponds to a power of 16. Starting from the rightmost digit, the first “A” occupies the 160 (ones) slot, the next “A” sits in the 161 place, and the leading “2” resides in the 162 slot. Remember that “A” in hex equals 10 in decimal, which lets you translate the entire value into decimal as shown below.

EX:2AA = (2 × 162) + (A × 161) + (A × 160)
 = (2 × 256) + (10 × 16) + (10 × 1)
 = 512 + 160 + 10 = 682

Turning a decimal number into its hexadecimal counterpart involves a few extra steps, though the underlying ideas stay the same. Follow the outlined procedure and work through the provided example to see how the conversion unfolds.

  1. Find the largest power of 16 that is less than or equal to the number to be converted, which will be referred to as X.
  2. Determine how many times the power of 16 found in Step 1 goes into X, and take note of that number.
  3. Multiply the number found in Step 2 by the power of 16 and subtract this value from X. This new value will be referred to as Y.
    • Bear in mind that the figure you obtain in Step 2 becomes the digit placed in the position that corresponds to the identified power of 16. For instance, if the highest power you discover is 164 and Step 2 yields the number 3, the resulting hexadecimal number will have a 3 in the 164 column, giving something like 3qrst, where qrst cover the 160 through 163 places.
  4. Apply Steps 1‑3 again, this time using Y as the new starting point. Continue iterating until the remaining value is smaller than 16, then assign that remainder to the 160 position.
  5. Assign each of the values found in each iteration of Step 2 to its respective place value to determine the hex value.
EX:Convert decimal 1500 to hex
 (1)Largest power = 162 = 256
 (2)256 × 5 = 1280, so (5 × 162)
 (3)1500 - 1280 = 220
 (4)16 × 13 = 208, so (13 × 161)
 (5)220 - 208 = 12
 (6)16 is larger than 12, so 12 is the value in the 160 place value
 (7)1500 = (5 × 162) + (13 × 161) + (12 × 160)
 (8)Remember that 10-15 have letter numerals In hex: 13 = D, and 12 = C
 (9)Therefore the hex value of 1500 is: 5DC

Converting a hexadecimal number back to decimal follows the same logic, only it tends to be more straightforward. Multiply each hex digit by its associated power of 16 and add up all the products. This method works whether the hex string contains letters or solely digits.

EX:Convert hex 1024 to decimal
 (1)(1 × 163) + (0 × 162) + (2 × 161) + (4 × 160)
 (2)4096 + 0 + 32 + 4 = 4132

Hex Addition

Hexadecimal addition obeys the same principles as decimal addition, with the only twist being the extra symbols A‑F. Keeping a quick reference of the decimal values for A through F can be handy until they’re memorized. Below you’ll find a sample hex addition; walk through it and consult the accompanying explanation for more insight.

EX:

When adding in hex you perform ordinary decimal addition while swapping between bases whenever a digit exceeds 9 (i.e., the letters A‑F). In the sample, B + 8 equals 11 + 8 = 19 in decimal, which translates to 13 in hex because 19 = 1·16 + 3. The 1 carries over to the next column, so the next column becomes 1 + A (10) + 7 = 18 decimal, or 12 hex. Carry the 1 again to the final column: 1 + 8 + B (11) = 20 decimal, which is 14 hex. The overall result is 1423hex.

Hex Subtraction

Hexadecimal subtraction is carried out much like hex addition, with the extra step of borrowing. When you borrow in the hex system, the “1” you take represents 16 in decimal rather than 10. This happens because the column you borrow from is sixteen times the size of the column you’re borrowing into (just as a borrowed 1 in decimal equals ten). As long as you keep this distinction in mind and translate the letters A‑F correctly, hex subtraction is no more difficult than its decimal counterpart. Follow the example and read the notes below for further clarification.

EX:

In the right‑most column of the subtraction example, C (12 decimal) is smaller than F (15 decimal), so we must borrow from the next column. This reduces the D in that column to C and adds a 1 (equivalent to 16 decimal) to the first column. Thus 16 + 12 − 15 = 13 decimal, which is D in hex. The remaining columns need no borrowing, making the rest of the calculation straightforward. Since we borrowed once, C − A becomes 12 − 10 = 2, and 5 − 3 = 2, giving the final answer 22D. If the subtrahend were larger than the minuend, simply swap the numbers, perform the subtraction, and prefix the result with a minus sign; for example, 3AF − 5DC would yield ‑22D.

Hex Multiplication

Multiplying numbers in hexadecimal is often cumbersome, as each step usually demands converting between base-16 and base-10 due to the larger digit values. A handy hex‑multiplication chart (shown beneath) can simplify the work; without it you’ll have to translate each operand manually. The following illustration demonstrates a hex‑multiplication problem, with the individual multiplication and addition phases displayed alongside it. All figures shown are in hex. See the addition guide for more details if needed.

EX:

Hex Division

Hexadecimal long division follows the same steps as decimal long division, but the intermediate multiplication and subtraction are performed in base-16. You may also choose to switch to base-10, complete the division there, and then translate the result back to hex. To illustrate, the following example is worked out completely in hex. As with the multiplication topic, a hex‑multiplication table (shown below) proves useful during the division process. All numbers in the example are expressed in hex. While this particular case does not require borrowing, keep in mind that a borrow in hex corresponds to 16 in decimal rather than 10. For more on borrowing, consult the hex subtraction section.

EX:    
DEF
12FACE
EA12 × D = EA
10CFA - EA = 10
FC12 × E = 10C
10E10C - FC = 10
10E12 × F = 10E
0

Hexadecimal Multiplication Table

×123456789ABCDEF10
1123456789ABCDEF10
22468ACE10121416181A1C1E20
3369CF1215181B1E2124272A2D30
448C1014181C2024282C3034383C40
55AF14191E23282D32373C41464B50
66C12181E242A30363C42484E545A60
77E151C232A31383F464D545B626970
88101820283038404850586068707880
99121B242D363F48515A636C757E8790
AA141E28323C46505A646E78828C96A0
BB16212C37424D58636E79848F9AA5B0
CC1824303C4854606C7884909CA8B4C0
DD1A2734414E5B6875828F9CA9B6C3D0
EE1C2A38465462707E8C9AA8B6C4D2E0
FF1E2D3C4B5A69788796A5B4C3D2E1F0
10102030405060708090A0B0C0D0E0F0100

Financial Fitness & Health Math Other