Hexadecimal Calculator
Instant Hex Arithmetic, All Operations
Type any two hex values, select an operation, and the result appears instantly in hex, decimal, and binary simultaneously. No button. No delay. Addition, subtraction, multiplication, division, modulo, and all bitwise operations — everything in one free browser-based hex calculator.
Base Conversion Breakdown
HEX (Base 16)
FF
DEC (Base 10)
255
BIN (Base 2)
11111111
💡 **Remember:** 1 Hex Digit = Exactly 4 Binary Bits (One Nibble)
Interactive Hex Calculator
Whether you're a student working through hex arithmetic for the first time or a developer doing bit manipulation on register values, this hexadecimal calculator handles it all. Type below.
e.g. FF, 0x1A, 4B2
Creating inverse masks
—
—
—
How to Add Hexadecimal Numbers
Hex addition works exactly like decimal addition — column by column, right to left. The only difference is where you carry. In decimal you carry when a column exceeds 9. In hex you carry when a column exceeds F (15). That one change is everything.
! The Hex Carry Rule
When a column sum exceeds F (15): subtract 16, write the remainder as the hex digit, carry 1 to the next column.
That's the complete rule. If column A + column B = 18 in decimal (hex 12), you write 2 and carry 1. The carry threshold is always 16 — never 10.
This is the mistake almost everyone makes first time. They apply the decimal carry rule (at 10) to hex and get a wrong answer. The threshold is 16. Always.
Visual Carry Flow
Sum = 18
Decimal value
18 - 16
2
Worked Example: A3 + 7F
| Position | Hex A + Hex 7 column | Hex 3 + Hex F column |
|---|---|---|
| Values | A (10) + 7 = 17 decimal | 3 + F (15) = 18 decimal |
| Exceeds 15? | Yes — 17 > 15 | Yes — 18 > 15 |
| Subtract 16 | 17 − 16 = 1 | 18 − 16 = 2 |
| Write digit | 1 | 2 |
| Carry | 1 to next column | 1 to A+7 column |
Final Result
A3 + 7F = 122 hex | 290 dec
Worked Example: FF + 1 (Carry Chain)
Column 1: F + 1 = 16 decimal → 16 − 16 = 0, carry 1 → write 0
Column 2: F + 1 (carry) = 16 decimal → 16 − 16 = 0, carry 1 → write 0
Column 3: carry → write 1
Insight: FF + 1 = 100 in hex. This is the overflow boundary. 0xFF is the maximum single-byte value (255). Adding 1 produces 0x100 — which requires 3 hex digits.
How to Subtract Hexadecimal Numbers
Hex subtraction is column-by-column right to left, same as decimal. The critical difference is borrowing. In decimal, borrowing gives you 10. In hex, borrowing gives you 16.
The Hex Borrow Rule
When the current digit is smaller than the digit being subtracted: borrow from the next column. The borrowed 1 adds 16 — not 10 — to your current digit.
⚠ This is the second most common error — people add 10 when they borrow and get the wrong answer every time.
Column giving borrow
C
B
Column receiving
3
3 + 16 = 19
19 − 15 = 4
Worked Example: 5D − 2A (No Borrow Needed)
Column 1: D (13) − A (10) = 3 → write 3
Column 2: 5 − 2 = 3 → write 3
5D − 2A = 33 ✅
Worked Example: C3 − 8F (Borrow Required)
Column 1: 3 − F — 3 is less than F (15). Borrow from next column.
Borrowed 1 from column 2 reduces C to B.
Current digit: 3 + 16 = 19 decimal. Now: 19 − 15 = 4 → write 4
Column 2: B (11) − 8 = 3 → write 3
Borrowing added 16 (not 10) to the current digit.
C3 − 8F = 34 ✅
How to Multiply Hexadecimal Numbers
Strategy: convert hex digits to decimal, multiply in decimal, then convert back. The decimal mid-step makes this tractable.
The Decimal Bridge Strategy
Convert digits to decimal, multiply, convert product back to hex.
- Take each hex digit as decimal
- Multiply in decimal
- Convert product back to hex
- Handle carry same as hex addition
Hex Multiplication Grid Interactive Grid
Worked Example: B3 × 4
↓ Col 1: 3 × 4 = 12 dec = C hex. Write C (no carry)
↓ Col 2: B(11) × 4 = 44 dec = 2C hex. Write C, carry 2
↓ Col 3: carry → write 2
B3 × 4 = 2CC hex = 716 decimal
How to Divide Hexadecimal Numbers
Hex division uses long division — the same process as decimal long division but with hex digits throughout.
The Long Division Method
- 1
Work left to right through the dividend
- 2
Find how many times the divisor fits into the current portion — work in decimal if needed
- 3
Write the quotient digit in hex
- 4
Multiply quotient digit by divisor, subtract from current portion
- 5
Bring down the next digit and repeat
- 6
Whatever remains when you can't divide further is the remainder
Worked Example: 1A8 ÷ C
1A8 = 424 decimal. C = 12 decimal. 424 ÷ 12 = 35 remainder 4.
1A (26 decimal) ÷ C (12) = 2 remainder 2 → write 2
Bring down 8: 28 (40 decimal) ÷ C (12) = 3 remainder 4 → write 3
Remainder: 4
🔁 What is Hex Modulo?
Modulo gives you the remainder only — without the quotient.
Bitwise Operations in Hex
Bitwise operations work on individual bits within hex values. They don't do arithmetic — they manipulate the binary representation of each hex digit directly. Every developer working with low-level code uses these constantly.
All bitwise results in this calculator are limited to 32-bit values.
Bitwise AND
Masking Bits
AND compares each bit position in two values. The result bit is 1 only if both input bits are 1.
0xFF & 0x0F = 0x0F
#IsolatingBitwise OR
Setting Bits
OR compares each bit position. Result is 1 if either input bit is 1. Only 0 OR 0 produces 0.
0x80 | 0x01 = 0x81
#SettingBitwise XOR
Toggling Bits
XOR compares each bit position. Result is 1 if input bits are different. Same bits produce 0.
0xAA ^ 0xFF = 0x55
#TogglingBitwise NOT
Inverting All Bits
NOT flips every bit. Every 0 becomes 1 and every 1 becomes 0.
~0x0F = 0xF0 (in 8-bit)
#CreatingBit Shifts
Multiply and Divide by Powers of 2
Left shift (<<) moves bits left by n positions, filling with 0s. Each position multiplies by 2. Right shift (>>) moves bits right, dividing by 2.
0x01 << 4 = 0x10
#PerfSigned vs Unsigned Hex — What Happens at Overflow
Same hex digits. Two completely different interpretations. This is the one concept that trips developers up most.
8-Bit Wrap-Around Scale
Unsigned Hex — Positive Values Only
In unsigned hex, every bit contributes to the magnitude. No negative values. Max 8-bit = 0xFF = 255. Max 16-bit = 0xFFFF = 65,535.
Overflow wraps to zero. 0xFF + 0x01 in unsigned 8-bit = 0x00 with carry out.
Signed Hex — Two's Complement
The MSB (most significant bit) is the sign bit. If it's 1, the number is negative.
0xFF unsigned = 255. 0xFF signed = −1. Same hex value — completely different meaning.
How Two's Complement Works
To find the two's complement negative: flip all bits (bitwise NOT), then add 1.
What Is Hexadecimal — And Why Does It Exist?
As you can see, hexadecimal is simply a more efficient way to represent binary data. Whether you're debugging firmware, picking CSS colors, or exploring memory offsets, mastering hex arithmetic is a key skill for any modern developer.
The etymology
The word 'hexadecimal' itself is a hybrid of Greek and Latin. 'Hex' comes from the Greek word for six, while 'decimal' is derived from the Latin for ten. Combined, they describe a system built on base-16. This provides exactly sixteen unique symbols—the numbers 0 through 9 and the letters A through F—to represent values.
Memory alignment structure
Where hex is used
HTML/CSS Colors
#FF0000 = red. Each channel is a hex byte (00–FF).
Memory Addresses
0x7FFF0000 + 0x100 = 0x7FFF0100. Finding offsets in a debugger requires hex addition.
MCU Registers
AND, OR, XOR on hex values to set, clear, and toggle configuration bits.
File Magic Bytes
PNG starts with 89 50 4E 47. PDF starts with 25 50 44 46.
URL Encoding
Space = ASCII 32 = hex 20. That's why URLs use %20.
CRC Checksums
XOR operations on hex bytes for error detection in files and network packets.
5 Common Mistakes in Decimal to Hex Conversion
Frequently Asked Questions
How to convert decimal to hex?
Divide the decimal number by 16. Record the remainder. Use the quotient for the next division. Repeat until the quotient is 0. Read remainders from bottom to top.
What is 255 in hex?
255 in decimal is FF in hexadecimal.
Why use hex instead of decimal?
Hex is much easier to map to binary. One hex digit represents exactly 4 bits (a nibble), making two hex digits equal to one byte (8 bits).
Ready to perform hex arithmetic flawlessly?
As you can see, hexadecimal is simply a more efficient way to represent binary data. Whether you're debugging firmware, picking CSS colors, or exploring memory offsets, mastering hex arithmetic is a key skill for any modern developer.
Use the Calculator