⬡ Hex Calculator: Add, Subtract, Multiply, Divide, and Convert Hex Numbers
Hexadecimal arithmetic, bitwise operations & multi-base converter
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
| Decimal | Hex | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 9 | 9 | 1001 |
| 10 | A | 1010 |
| 11 | B | 1011 |
| 15 | F | 1111 |
| 16 | 10 | 10000 |
| 255 | FF | 11111111 |
| 256 | 100 | 100000000 |
| 1000 | 3E8 | 1111101000 |
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
- Write down each hex digit separately.
- Convert letter digits to numbers. A=10, B=11, C=12, D=13, E=14, F=15.
- Multiply each digit by 16 raised to its position (starting from 0 on the right).
- 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
| Hex | Decimal | Hex | Decimal |
|---|---|---|---|
| 0A | 10 | 64 | 100 |
| 0F | 15 | 7F | 127 |
| 10 | 16 | 80 | 128 |
| 20 | 32 | FF | 255 |
| 3F | 63 | 100 | 256 |
| 40 | 64 | 3E8 | 1,000 |
| 61 | 97 | FFFF | 65,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
- Divide the decimal number by 16.
- Note the remainder. If it is 10 or higher, write it as A, B, C, D, E, or F.
- Divide the quotient again by 16.
- Repeat until the quotient is 0.
- 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
| Decimal | Hex | Decimal | Hex |
|---|---|---|---|
| 10 | A | 128 | 80 |
| 16 | 10 | 160 | A0 |
| 32 | 20 | 255 | FF |
| 64 | 40 | 256 | 100 |
| 100 | 64 | 1,000 | 3E8 |
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
| Hex | Binary | Hex | Binary |
|---|---|---|---|
| 0 | 0000 | 8 | 1000 |
| 1 | 0001 | 9 | 1001 |
| 2 | 0010 | A | 1010 |
| 3 | 0011 | B | 1011 |
| 4 | 0100 | C | 1100 |
| 5 | 0101 | D | 1101 |
| 6 | 0110 | E | 1110 |
| 7 | 0111 | F | 1111 |
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
- Convert the hex number to binary.
- Flip all bits (NOT operation).
- Add 1 to the result.
- 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
| Hex | Unsigned | Signed 8-bit |
|---|---|---|
| 00 | 0 | 0 |
| 7F | 127 | 127 |
| 80 | 128 | -128 |
| FE | 254 | -2 |
| FF | 255 | -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
- Add all bytes in the record (byte count, address, type, and data bytes).
- Take only the lowest byte of the sum (drop anything above FF).
- Calculate the two’s complement of that byte.
- 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
- Convert each R, G, B decimal value to a two-digit hex number.
- 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
| Color | Hex Code | R | G | B |
|---|---|---|---|---|
| Black | #000000 | 0 | 0 | 0 |
| White | #FFFFFF | 255 | 255 | 255 |
| Red | #FF0000 | 255 | 0 | 0 |
| Green | #00FF00 | 0 | 255 | 0 |
| Blue | #0000FF | 0 | 0 | 255 |
| Gray | #808080 | 128 | 128 | 128 |
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
- Split the hex string into 2-character pairs.
- Convert each pair to decimal.
- Match each decimal to its ASCII character.
Example: Decode “48 65 6C 6C 6F”
| Hex | Decimal | Character |
|---|---|---|
| 48 | 72 | H |
| 65 | 101 | e |
| 6C | 108 | l |
| 6C | 108 | l |
| 6F | 111 | o |
Result: Hello
Common ASCII to Hex Reference
| Character | Decimal | Hex |
|---|---|---|
| Space | 32 | 20 |
| 0 | 48 | 30 |
| A | 65 | 41 |
| Z | 90 | 5A |
| a | 97 | 61 |
| z | 122 | 7A |
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
| Bits | Hex Digits | Max Hex | Max Decimal |
|---|---|---|---|
| 4 | 1 | F | 15 |
| 8 | 2 | FF | 255 |
| 16 | 4 | FFFF | 65,535 |
| 32 | 8 | FFFFFFFF | 4,294,967,295 |
| 64 | 16 | FFFFFFFFFFFFFFFF | 18,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
| Character | Hex | URL Encoded |
|---|---|---|
| Space | 20 | %20 |
| # | 23 | %23 |
| & | 26 | %26 |
| / | 2F | %2F |
| : | 3A | %3A |
| ? | 3F | %3F |
| @ | 40 | %40 |
Hex vs Other Number Systems
| Feature | Binary | Octal | Decimal | Hex |
|---|---|---|---|---|
| Base | 2 | 8 | 10 | 16 |
| Digits | 0, 1 | 0-7 | 0-9 | 0-9, A-F |
| Bits per digit | 1 | 3 | ~3.32 | 4 |
| 1 byte written as | 8 digits | 3 digits | Up to 3 | 2 digits |
| 255 written as | 11111111 | 377 | 255 | FF |
| Main use | CPU, hardware | Unix permissions | Daily math | Programming, 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
Related Tools
- Binary Calculator — Add, subtract, multiply, and divide binary numbers.
External references:
- Unicode Character Database — Official Unicode code charts in hex.
- ASCII Reference at Princeton — Full ASCII table with hex values.
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.

