Hexadecimal Calculator

Perform arithmetic operations between hexadecimal numbers or use our instant converters from hexadecimal to decimal and vice versa. Accurate and easy-to-copy results.

Invalid hexadecimal 1
Invalid hexadecimal 2

Result in hexadecimal:

Result in decimal:

Invalid hexadecimal number

Decimal Number

Invalid decimal number

Hexadecimal Number

What Are Hexadecimal Numbers? Examples

Hexadecimal is a numeral system that uses 16 symbols instead of the 10 used in the decimal system. The symbols are the digits 0 to 9 and the letters A, B, C, D, E, and F. Hexadecimal numbers are often used in programming to represent binary values more compactly.

Some examples of hexadecimal numbers include:

  • 1F (31 in decimal)
  • A0 (160 in decimal)
  • FF (255 in decimal)

How to Convert Hexadecimal to Decimal

To convert a hexadecimal number to decimal, the following formula is used:

(digit_1 · 16^(n-1)) + (digit_2 · 16^(n-2)) + ... + (digit_n · 16^0)

Where digit_1 is the leftmost digit of the hexadecimal number, digit_2 is the next, and so on, and n is the total number of digits that make up the hexadecimal number to be converted.

Example: Convert the hexadecimal number 5A to decimal.

  1. Determine the value of n. In this case, n = 2
  2. Transform each hexadecimal digit into its decimal form. In this case, 5 = 5 and A = 10
  3. Replace the digits in their decimal form in the formula. This way we have:
(5 · 16^1) + (10 · 16^0) = (5 · 16) + (10 · 1) = (80) + (10) = 90

Table of Equivalents Between Decimal, Hexadecimal, and Binary Numbers

Representation of numbers in each of the numbering systems.

Decimal System
Hexadecimal System
Binary System
0
0
0
1
1
1
2
2
10
3
3
11
4
4
100
5
5
101
6
6
110
7
7
111
8
8
1000
9
9
1001
10
A
1010
11
B
1011
12
C
1100
13
D
1101
14
E
1110
15
F
1111

How to Add Hexadecimal Numbers

Adding hexadecimal numbers is similar to adding decimal numbers, but with some important differences due to the different number base. Here's an example of how to add two hexadecimal numbers:

Example: Adding 5A (90 in decimal) and 3F (63 in decimal) step by step

  1. We start by adding the units digits (or least significant digits) first: A + F = 17 (in decimal)
  2. As the result is greater than 15, we carry 1 to the next column
  3. We continue adding the other columns: 5 + 3 + 1 (carried) = 9
  4. The final result is 99 (153 in decimal)

How to Subtract Hexadecimal Numbers

Subtracting hexadecimal numbers is similar to subtracting decimal numbers, but with some important differences due to the different number base. Here's an example of how to subtract two hexadecimal numbers:

Example: Subtract 7B (123 in decimal) - 5F (95 in decimal) step by step

  1. We start by subtracting the units digits (or least significant digits) first: B - F. Since B (11 in decimal) is less than F (15 in decimal), we must "borrow" one from the tens place of the hexadecimal number. In this case, we would have 1B (27 in decimal) - F (15 in decimal) = C (12 in decimal).
  2. We continue subtracting the other columns: (7 - 1) - 5 = 1, as in the previous step, we borrowed one from 7.
  3. The final result is 1C (28 in decimal)