⬡ Hex Calculator: Add, Subtract, Multiply, Divide, and Convert Hex Numbers

Hexadecimal arithmetic, bitwise operations & multi-base converter

Operands
Operation
Please enter valid hex values.
Expression
Hex
Result (Base 16)
Decimal
Result (Base 10)
Binary
Result (Base 2)
Octal
Result (Base 8)
Result Breakdown
Hex Result
Hex with 0x Prefix
Decimal
Binary (grouped)
Octal
Bit Length
Byte Length
Step-by-Step Explanation
Enter Any Value — Others Update Instantly
HEX
DEC
BIN
OCT
Invalid input.
Conversion Summary
Hexadecimal
0x Prefixed
Decimal
Binary
Binary (nibble groups)
Octal
ASCII Character
Bit Length
Byte Length
Enter Hex Value to Visualize Bits
Please enter a valid hex value.
32-Bit Visual Representation
Bit Details
Hex Value
Decimal
Binary (full)
Count of 1-bits
Count of 0-bits
Most Significant Bit
Least Significant Bit

Looking for other number tools? Browse our full list of math calculators including binary, scientific, and fraction tools.

A hex calculator is one of the most useful tools for anyone working with computers, code, or electronics. Whether you need to add hex numbers, convert hex to decimal, or run bitwise operations, this page covers everything in one place.

Use the calculator above to get instant results. Below, you will find clear explanations, worked examples, and reference tables for every type of hex calculation.

What Is a Hexadecimal Number?

Hexadecimal is a base-16 number system. Most people use base-10 (decimal) in everyday life. Computers, however, prefer binary (base-2). Hex sits in the middle as a compact way to represent binary values.

Hex uses 16 symbols:

  • Digits 0 through 9 (same as decimal)
  • Letters A through F (representing values 10 through 15)

So after 9, the count continues as A, B, C, D, E, F. After F, hex carries over to the next column, just like decimal goes from 9 to 10.

Example: Hex 10 equals decimal 16.

Hex, Decimal, and Binary Comparison Table

DecimalHexBinary
000000
991001
10A1010
11B1011
15F1111
161010000
255FF11111111
256100100000000
10003E81111101000

Why Do Computers Use Hex?

Binary is how computers actually work. Every piece of data is stored as 0s and 1s. But long binary strings are hard to read and easy to mistype.

Here is the key fact: one hex digit always represents exactly 4 binary digits. That group of 4 bits is called a nibble.

So 1 byte (8 bits) is always 2 hex digits. That makes hex far more compact.

Example: Binary 11111111 becomes FF in hex. Same value, much shorter.

Where You See Hex Every Day

  • Memory addresses in code: 0x004A3F21
  • CSS and HTML colors: #FF5733
  • URL encoding: %20 means a space character
  • HTML character references: ‘ is a single quote
  • File checksums and hash values
  • Network MAC addresses: 00:1A:2B:3C:4D:5E
  • ASCII and Unicode character values

Programmers, software engineers, electronics designers, and computer science students use a hex calculator constantly. If you work with Arduino, ESP32, embedded systems, or assembly language, hex is part of your daily workflow.

Hex to Decimal Conversion

Converting hex to decimal is straightforward once you understand place values.

Each hex digit represents a power of 16. The rightmost digit is 16^0 (equals 1). The next is 16^1 (equals 16). Then 16^2 (equals 256), and so on.

Step-by-Step: How to Convert Hex to Decimal

  1. Write down each hex digit separately.
  2. Convert letter digits to numbers. A=10, B=11, C=12, D=13, E=14, F=15.
  3. Multiply each digit by 16 raised to its position (starting from 0 on the right).
  4. Add all the results together.

Example 1: Convert 2AA to Decimal

  • A (position 0): 10 x 1 = 10
  • A (position 1): 10 x 16 = 160
  • 2 (position 2): 2 x 256 = 512
  • Total: 512 + 160 + 10 = 682

Example 2: Convert FF to Decimal

  • F (position 0): 15 x 1 = 15
  • F (position 1): 15 x 16 = 240
  • Total: 240 + 15 = 255

Example 3: Convert 1A3F to Decimal

  • F (position 0): 15 x 1 = 15
  • 3 (position 1): 3 x 16 = 48
  • A (position 2): 10 x 256 = 2,560
  • 1 (position 3): 1 x 4,096 = 4,096
  • Total: 6,719

Use the hex to decimal calculator above to verify any result instantly. No manual steps needed.

Common Hex to Decimal Values

HexDecimalHexDecimal
0A1064100
0F157F127
101680128
2032FF255
3F63100256
40643E81,000
6197FFFF65,535

Decimal to Hex Conversion

To convert decimal to hex, use repeated division by 16. Read the remainders from bottom to top to get your hex result.

Step-by-Step: How to Convert Decimal to Hex

  1. Divide the decimal number by 16.
  2. Note the remainder. If it is 10 or higher, write it as A, B, C, D, E, or F.
  3. Divide the quotient again by 16.
  4. Repeat until the quotient is 0.
  5. Read remainders bottom to top.

Example 1: Convert 255 to Hex

  • 255 / 16 = 15, remainder 15 (F)
  • 15 / 16 = 0, remainder 15 (F)
  • Read bottom to top: FF

Example 2: Convert 1,500 to Hex

  • 1500 / 16 = 93, remainder 12 (C)
  • 93 / 16 = 5, remainder 13 (D)
  • 5 / 16 = 0, remainder 5
  • Read bottom to top: 5DC

Example 3: Convert 1,024 to Hex

  • 1024 / 16 = 64, remainder 0
  • 64 / 16 = 4, remainder 0
  • 4 / 16 = 0, remainder 4
  • Read bottom to top: 400

The decimal to hex calculator tab above handles this instantly. Type in any decimal number and get the hex result with a full breakdown.

Quick Reference: Common Decimal to Hex Values

DecimalHexDecimalHex
10A12880
1610160A0
3220255FF
6440256100
100641,0003E8

Hex to Binary and Binary to Hex

This is the easiest conversion in all of number systems. Every hex digit maps directly to exactly 4 binary digits. No math needed. Just replace each hex digit with its 4-bit binary group, or vice versa.

Hex to Binary Lookup Table

HexBinaryHexBinary
0000081000
1000191001
20010A1010
30011B1011
40100C1100
50101D1101
60110E1110
70111F1111

Example: Hex to Binary

Convert 2AA to binary:

  • 2 = 0010
  • A = 1010
  • A = 1010
  • Result: 0010 1010 1010

Example: Binary to Hex

Convert 1101 1010 1111 to hex:

  • 1101 = D
  • 1010 = A
  • 1111 = F
  • Result: DAF

The hex to binary calculator tab converts any value in either direction. Results are shown with nibble grouping for easy reading.

Hexadecimal Addition

Adding hex numbers follows the same logic as adding decimal numbers. The only rule change is that you carry when the sum reaches 16, not 10.

  • Sum less than 16: write it directly.
  • Sum 16 or higher: subtract 16, write the remainder, carry 1 to the next column.

Example 1: No Carry

  A + 5 = F

10 + 5 = 15 = F in hex. Simple.

Example 2: Addition With Carry

  1A + B7
  • Right column: A + 7 = 10 + 7 = 17. Write 1, carry 1.
  • Next column: 1 + B + 1 = 1 + 11 + 1 = 13 = D.
  • Result: D1

Verify: 1A = 26, B7 = 183. Sum = 209. D1 = (13 x 16) + 1 = 209. Correct.

Example 3: Carry Across All Columns

  FF + 01
  • F + 1 = 16. Write 0, carry 1.
  • F + 0 + 1 = 16. Write 0, carry 1.
  • New digit: 1.
  • Result: 100

Verify: FF = 255. 01 = 1. 255 + 1 = 256 = 100 hex. Correct.

Use the hex addition calculator above to check your work. It shows the full carry process step by step.

Hexadecimal Subtraction

Hex subtraction works column by column from right to left. When the top digit is smaller than the bottom digit, you borrow from the next column. Borrowing in hex adds 16, not 10.

Example 1: No Borrow

  F - 4 = B

15 – 4 = 11 = B. Done.

Example 2: With Borrowing

  23 - 7
  • Right column: 3 – 7 cannot be done. Borrow. 3 + 16 = 19. 19 – 7 = 12 = C.
  • Next column: 2 – 1 (borrowed) = 1.
  • Result: 1C

Verify: 23 hex = 35. 35 – 7 = 28. 1C = 16 + 12 = 28. Correct.

Example 3: Multiple Borrows

  5A - 2F
  • Right column: A – F = 10 – 15. Borrow. 10 + 16 = 26. 26 – 15 = 11 = B.
  • Next column: 5 – 1 – 2 = 2.
  • Result: 2B

Verify: 5A = 90. 2F = 47. 90 – 47 = 43. 2B = 32 + 11 = 43. Correct.

Hexadecimal Multiplication

The easiest approach is to multiply in decimal, then convert the result back to hex.

Example 1: Single Digit

  A x 3

A = 10. 10 x 3 = 30 decimal. 30 / 16 = 1 remainder 14 (E). Result: 1E

Example 2: Two-Digit Multiplication

  2A x 3
  • A x 3 = 30 = 1E. Write E, carry 1.
  • 2 x 3 = 6. Add carry 1 = 7.
  • Result: 7E

Verify: 2A = 42. 42 x 3 = 126. 7E = (7 x 16) + 14 = 126. Correct.

Hexadecimal Division

Convert to decimal, divide, then convert the result back to hex.

Example: Divide 7E by 3

  • 7E = 126 decimal.
  • 126 / 3 = 42.
  • 42 decimal = 2A hex.

The hex calculator above handles division and returns both the integer result and any remainder separately.

Bitwise Operations in Hex

This is one area most other tools ignore or explain poorly. Bitwise operations work on individual binary bits inside a hex value. They are used every day in programming, encryption, networking, and embedded systems.

Our hexadecimal calculator supports all six bitwise operations.

AND (&)

Result is 1 only if BOTH bits are 1.

Use for: masking, checking if a flag is set, filtering specific bits.

  A AND 6
  A = 1010
  6 = 0110
  Result = 0010 = 2

OR ( | )

Result is 1 if EITHER bit is 1.

Use for: setting specific bits, combining flag values.

  A OR 6
  A = 1010
  6 = 0110
  Result = 1110 = E

XOR (^)

Result is 1 if the bits are different. Result is 0 if they are the same.

Use for: toggling bits, simple encryption, checksum calculations.

  A XOR 6
  A = 1010
  6 = 0110
  Result = 1100 = C

The XOR hex calculator tab shows the full binary comparison step by step.

NOT (~)

Flips every bit. 1 becomes 0, 0 becomes 1. The result depends on the bit width you choose (8, 16, or 32 bits).

  NOT 0F (8-bit)
  0F = 0000 1111
  NOT = 1111 0000 = F0

Left Shift (<<)

Moves all bits to the left by N positions. Same as multiplying by 2^N.

  01 << 3 = 08
  (1 x 2^3 = 8)

Right Shift (>>)

Moves all bits to the right by N positions. Same as dividing by 2^N (integer result).

  10 >> 1 = 08
  (16 / 2 = 8)

Two’s Complement and Negative Hex Numbers

Computers store negative numbers using two’s complement. This is how a signed hex value represents a negative decimal number. Understanding this matters when reading memory dumps, register values, or binary files.

How to Calculate Two’s Complement

  1. Convert the hex number to binary.
  2. Flip all bits (NOT operation).
  3. Add 1 to the result.
  4. Convert back to hex.

Example: Two’s Complement of 05 (8-bit)

  • 05 in 8-bit binary: 0000 0101
  • Flip all bits: 1111 1010
  • Add 1: 1111 1011 = FB
  • In a signed 8-bit system, FB = -5.

Signed vs Unsigned Hex Reference

HexUnsignedSigned 8-bit
0000
7F127127
80128-128
FE254-2
FF255-1

Use the 2s complement hex calculator tab to convert any signed hex value instantly.

Hex Checksum Calculation

A checksum confirms that data has not been corrupted. The Intel HEX file format uses checksums in every record line. If you work with firmware files, microcontrollers, or memory programming, you will encounter this.

Intel HEX Checksum Method

  1. Add all bytes in the record (byte count, address, type, and data bytes).
  2. Take only the lowest byte of the sum (drop anything above FF).
  3. Calculate the two’s complement of that byte.
  4. That is your checksum.

Example

Record bytes: 02, 00, 00, 00, FF, FE

  • Sum: 02 + 00 + 00 + 00 + FF + FE = 1FF
  • Lowest byte: FF
  • Two’s complement: 01
  • Checksum = 01

Use the hex checksum calculator above to verify Intel HEX file records automatically.

Hex Color Codes

Every web color is written as a hex value. The format is #RRGGBB. Each pair of hex digits controls one color channel: red, green, and blue. Each channel ranges from 00 (none) to FF (maximum, or 255 in decimal).

Reading a Hex Color Code

#FF5733:

  • Red: FF = 255 (maximum)
  • Green: 57 = 87
  • Blue: 33 = 51
  • Result: a warm orange-red.

RGB to Hex Conversion

  1. Convert each R, G, B decimal value to a two-digit hex number.
  2. Join the three results with a # prefix.

Example: RGB(72, 201, 176)

  • 72 = 48
  • 201 = C9
  • 176 = B0
  • Result: #48C9B0

Hex to RGB Conversion

Split the hex code into three pairs and convert each to decimal.

Example: #A52A2A

  • A5 = 165 (Red)
  • 2A = 42 (Green)
  • 2A = 42 (Blue)

Use the RGB to hex calculator or hex to RGB calculator tab for instant conversion.

Common Hex Color Reference

ColorHex CodeRGB
Black#000000000
White#FFFFFF255255255
Red#FF000025500
Green#00FF0002550
Blue#0000FF00255
Gray#808080128128128

Hex to ASCII and Text Conversion

ASCII maps every common character to a number. That number can be expressed in hex. This is how computers store and transmit text as raw data.

How to Convert Hex to Text

  1. Split the hex string into 2-character pairs.
  2. Convert each pair to decimal.
  3. Match each decimal to its ASCII character.

Example: Decode “48 65 6C 6C 6F”

HexDecimalCharacter
4872H
65101e
6C108l
6C108l
6F111o

Result: Hello

Common ASCII to Hex Reference

CharacterDecimalHex
Space3220
04830
A6541
Z905A
a9761
z1227A

Use the hex to ASCII calculator tab to decode any hex string to readable text.

Bits, Nibbles, and Bytes in Hex

These three units define how much data a hex value holds. Understanding them helps you work with registers, memory, and data formats.

  • 1 bit = a single 0 or 1.
  • 4 bits = 1 nibble = 1 hex digit.
  • 8 bits = 1 byte = 2 hex digits.
  • 16 bits = 2 bytes = 4 hex digits.
  • 32 bits = 4 bytes = 8 hex digits.

Maximum Values by Bit Width

BitsHex DigitsMax HexMax Decimal
41F15
82FF255
164FFFF65,535
328FFFFFFFF4,294,967,295
6416FFFFFFFFFFFFFFFF18,446,744,073,709,551,615

A quick tip: look at how many hex digits a value has and you instantly know how many bits it occupies. FF = 2 digits = 8 bits. FFFF = 4 digits = 16 bits.

Hex in IP Addresses and Networking

IP addresses and network data are often shown in hex, especially in packet captures, network debugging tools, and protocol documentation.

Convert an IP Address to Hex

Convert each of the 4 decimal octets to a 2-digit hex number.

Example: 192.168.10.255

  • 192 = C0
  • 168 = A8
  • 10 = 0A
  • 255 = FF
  • Result: C0.A8.0A.FF or as one value: C0A80AFF

MAC Addresses

MAC addresses are already written in hex. Each two-character group is one byte.

Example: 00:1A:2B:3C:4D:5E = 6 bytes = 48 bits of address data.

Use the IP to hex calculator in the converter tab to switch between formats quickly.

URL Percent Encoding and Hex

Web browsers cannot send spaces or special characters in URLs. They encode them using the hex value of the character, prefixed with a percent sign.

This is called percent-encoding or URL encoding.

Example: A space has ASCII value 32, which is hex 20. So a space in a URL becomes %20.

Common URL-Encoded Characters

CharacterHexURL Encoded
Space20%20
#23%23
&26%26
/2F%2F
:3A%3A
?3F%3F
@40%40

Hex vs Other Number Systems

FeatureBinaryOctalDecimalHex
Base281016
Digits0, 10-70-90-9, A-F
Bits per digit13~3.324
1 byte written as8 digits3 digitsUp to 32 digits
255 written as11111111377255FF
Main useCPU, hardwareUnix permissionsDaily mathProgramming, colors, networking

Hex wins on readability for binary data. It keeps values short while mapping perfectly to the underlying bits.

How to Use This Hex Calculator

This tool has three tabs. Each one serves a different purpose.

Tab 1: Hex Arithmetic

  • Enter Value A (any hex number).
  • Enter Value B (any hex number).
  • Pick an operation from the pill buttons: Add, Subtract, Multiply, Divide, Modulo, AND, OR, XOR, NOT, Left Shift, Right Shift.
  • Click Calculate.

Results appear in hex, decimal, binary, and octal simultaneously. Each result has a Copy button. A step-by-step explanation shows exactly how the answer was reached.

Tab 2: Base Converter

Type a value in any field (hex, decimal, binary, or octal). All other fields update instantly.

Also shows: ASCII character, nibble-grouped binary, 0x-prefixed hex, bit count, and byte count.

Tab 3: Bit Viewer

Enter a hex value. Choose 8, 16, or 32-bit width. A color-coded grid shows every bit visually.

  • Purple squares = 1 bits.
  • Gray squares = 0 bits.
  • Each nibble group shows its hex digit above.
  • Stats shown: count of 1-bits, count of 0-bits, MSB, and LSB.

Frequently Asked Questions

The 0x prefix is just a notation. It tells you the number that follows is written in hexadecimal. For example, 0xFF means FF in hex, which equals 255 in decimal. The 0x itself has no value.

Excel has no direct hex addition function. Use this formula instead: =DEC2HEX(HEX2DEC(A1) + HEX2DEC(B1))

Replace A1 and B1 with the cells that hold your hex values. This converts each to decimal, adds them, and converts the result back to hex.

Unsigned hex treats all values as positive. Signed hex uses the most significant bit to indicate whether a number is positive or negative. In a signed 8-bit system, 7F is the largest positive value (127). 80 represents -128. FF represents -1.

One hex digit always represents exactly 4 bits, called a nibble. Two hex digits = 1 byte = 8 bits.

XOR (Exclusive OR) is used in encryption, checksums, error detection, and toggling bits. It returns 1 when two bits differ and 0 when they match. Programmers use it to flip specific bits without affecting others.

Yes. Use two’s complement. Convert the positive version to binary, flip all bits, then add 1. The result is the hex representation of that negative number. For a signed 8-bit system, the negative of 05 is FB.

Related Tools

External references:

Conclusion

A good hex calculator saves time and prevents errors. Whether you are converting hex to decimal, adding hex numbers, running bitwise operations, or reading hex color codes, having one reliable tool for everything matters.

This hex calculator supports 11 arithmetic operations, live base conversion across four number systems, and a visual 32-bit viewer. Every result includes a full breakdown so you understand the answer, not just see it.

Bookmark this page. Use it whenever you need fast, accurate hex calculations.