Hex Calculator

Perform hexadecimal arithmetic operations and convert between hex, decimal, and binary

Hexadecimal Calculation—Add, Subtract, Multiply, or Divide

Convert Hexadecimal Value to Decimal Value

Convert Decimal Value to Hexadecimal Value

Introduction to Hexadecimal System

Hexadecimal (hex) is a base-16 numbering system that uses 16 distinct symbols: the digits 0-9 to represent values zero to nine, and the letters A-F (or a-f) to represent values ten to fifteen. In hexadecimal, A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.

Each hexadecimal digit represents exactly 4 binary digits (bits), also known as a "nibble." This makes hexadecimal particularly useful for representing binary data in a more compact and human-readable form. For example, the binary number 1010101010 can be represented more compactly as 2AA in hexadecimal.

Why Use Hexadecimal?

  • Compact representation of binary data (each hex digit = 4 bits)
  • Easy conversion between hex and binary
  • Commonly used in computer science, programming, and digital electronics
  • Used in memory addresses, color codes (e.g., #FF0000 for red), and file formats

Hex/Decimal Conversion

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

Converting between Decimal and Hex

Hexadecimal uses a positional notation system where each position represents a power of 16. The rightmost position is 16⁰ (1), the next is 16¹ (16), then 16² (256), 16³ (4096), and so on.

Example: Converting Hex to Decimal (2AA)

(2 × 16²) + (A × 16¹) + (A × 16⁰)

= (2 × 256) + (10 × 16) + (10 × 1)

= 512 + 160 + 10

= 682

Example: Converting Decimal to Hex (1500)

Step 1: Largest power of 16 ≤ 1500 is 16² = 256

Step 2: 1500 ÷ 256 = 5 remainder 220 (5 is the value in the 16² place)

Step 3: 256 × 5 = 1280

Step 4: 1500 - 1280 = 220

Step 5: 220 ÷ 16 = 13 remainder 12 (13 is the value in the 16¹ place)

Step 6: 16 × 13 = 208

Step 7: 220 - 208 = 12 (12 is the value in the 16⁰ place)

Step 8: Remember: 10=A, 11=B, 12=C, 13=D, 14=E, 15=F

Step 9: Therefore, 1500 (decimal) = 5DC (hex)

Example: Converting Hex to Decimal (C04)

(C × 16²) + (0 × 16¹) + (4 × 16⁰)

= (12 × 256) + (0 × 16) + (4 × 1)

= 3072 + 0 + 4

= 3076

Hex Addition

Hexadecimal addition works similarly to decimal addition, but you carry when the sum exceeds 15 (F). When adding, if the result in any column is 16 or greater, you subtract 16 and carry 1 to the next column.

Example:

8AB

+ 878

1423

B (11) + 8 = 19 (decimal) = 13 (hex, which is D), carry 1
1 + A (10) + 7 = 18 (decimal) = 12 (hex, which is C), carry 1
1 + 8 + 8 = 17 (decimal) = 11 (hex, which is B), carry 1
Final carry: 1 = 1
Result: 1423 (hex)

Hex Subtraction

Hexadecimal subtraction works similarly to decimal subtraction, but when you need to borrow, you borrow 16 (not 10) from the next column. This is because each position represents a power of 16.

Example:

5DC

- 3A1

23B

C (12) - 1 = 11 (B)
D (13) - A (10) = 3
5 - 3 = 2
Result: 23B (hex)

Hex Multiplication

Hexadecimal multiplication can be performed directly in hex, but it often requires converting to decimal for intermediate calculations, especially for larger numbers. The process is similar to decimal multiplication but uses base-16 arithmetic.

Example: FA × 3

FA

× 3

2EE

3 × A (10) = 30 (decimal) = 1E (hex), write E, carry 1
3 × F (15) + 1 = 45 + 1 = 46 (decimal) = 2E (hex)
Result: 2EE (hex)

Hex Division

Hexadecimal division can be performed using long division in hex, similar to decimal long division. Alternatively, you can convert both numbers to decimal, perform the division, and convert the result back to hex.

Examples:

12 (hex) ÷ 2 = 9 (hex) [18 (decimal) ÷ 2 = 9 (decimal)]

12 (hex) ÷ 3 = 6 (hex) [18 (decimal) ÷ 3 = 6 (decimal)]

12 (hex) ÷ 4 = 4.8 (hex) [18 (decimal) ÷ 4 = 4.5 (decimal) = 4.8 (hex)]

12 (hex) ÷ 5 = 3.C (hex) [18 (decimal) ÷ 5 = 3.6 (decimal) = 3.C (hex)]

12 (hex) ÷ 6 = 3 (hex) [18 (decimal) ÷ 6 = 3 (decimal)]

12 (hex) ÷ 7 = 2.B (hex) [18 (decimal) ÷ 7 ≈ 2.571 (decimal) = 2.B (hex)]

12 (hex) ÷ 8 = 2.4 (hex) [18 (decimal) ÷ 8 = 2.25 (decimal) = 2.4 (hex)]

12 (hex) ÷ 9 = 2 (hex) [18 (decimal) ÷ 9 = 2 (decimal)]

Hexadecimal Multiplication Table

This table shows the product of any two hexadecimal digits from 1 to F, plus 10. Use this table as a reference for hexadecimal multiplication.

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