Hex Calculator
Do arithmetic and bitwise math on two hex numbers and convert the result to decimal and binary.
Example
Add 1A and 0F:
1A (hex) = 26 (dec)
0F (hex) = 15 (dec)
26 + 15 = 41 (dec)
41 (dec) = 29 (hex) = 101001 (bin)
Result: 29 hex, 41 decimal, 101001 binary.
How it works
Enter two hexadecimal values, pick an operation (+, -, x, /, AND, OR, XOR), and the tool shows the hex result alongside its decimal and binary forms. Invalid hex characters are flagged instead of crashing.
Good to know
The Hex Calculator takes two hexadecimal numbers and runs an operation between them, then shows the answer three ways at once: as hex, as a decimal integer, and as binary. Alongside the result it also breaks out the decimal value of each input (Dec A and Dec B), so you can sanity-check what your hex strings actually mean before trusting the math. It is aimed at programmers, embedded and firmware developers, students learning number bases, and anyone debugging memory addresses, color codes, register masks, or byte values.
Reach for it when doing arithmetic by hand would be slow or error-prone: summing offsets to find a memory address, subtracting two pointers to get a size, or computing a bitmask with AND, OR, and XOR. The eight operations are add, subtract, multiply, integer divide, modulo, and the three bitwise operators. You can paste values with or without a leading 0x, and case does not matter, so 0x1a and 1A behave identically.
Reading the output is straightforward, but watch the signs and the bases. Subtraction can produce a negative result, which is shown with a leading minus on both the hex and binary lines rather than as a two's-complement value. Division and modulo are integer-only, so 1F / 4 discards the remainder. The bitwise operators work on 32-bit unsigned integers, which is the key thing to keep in mind for large inputs.
A practical caveat: because the tool relies on standard JavaScript numbers, very large hex values lose precision once they exceed about 15-16 significant digits, and bitwise operations silently truncate inputs to 32 bits. For exact work on long addresses or 64-bit registers, split the value into smaller chunks or verify the result against a fixed-width tool. Everything runs locally in your browser, so nothing you type is sent anywhere.
Frequently asked questions
Can I enter hex values with a 0x prefix?
Yes. A leading 0x or 0X is stripped automatically, so both 0x1A and 1A are accepted. Only the digits 0-9 and A-F (case-insensitive) are valid.
How are division and AND/OR/XOR handled?
Division and mod use integer (truncated) arithmetic, so A / B drops any remainder. The bitwise AND, OR and XOR operate on the 32-bit unsigned integer values of A and B.
Is my data uploaded anywhere?
No — this calculator runs entirely in your browser; nothing is uploaded.
Is it free?
Yes, completely free with no sign-up and no limits.
People also ask
How do you add two hexadecimal numbers?
Convert each hex value to decimal, add them, then convert the sum back to hexadecimal. For example, 1A is 26 and 0F is 15, so the sum is 41 decimal, which is 29 in hex. The calculator does all three steps automatically.
What is 0xFF in decimal?
0xFF equals 255 in decimal. It is the largest value a single byte (8 bits) can hold, which is why it appears so often in color codes and bitmasks.
Does the hex calculator handle negative results?
Yes. Operations like subtraction can return a negative number, and the result is shown with a leading minus sign on both the hex and binary lines. It is not displayed as a two's-complement representation.
Why does my hex division not show a remainder?
Division here is integer (truncated), so it drops the fractional part and shows only the whole quotient. If you need the remainder, use the A mod B operation, which returns exactly that leftover value.
What does a bitwise XOR do with hex numbers?
XOR compares the two values bit by bit and sets each output bit to 1 only when the input bits differ. It is commonly used for toggling flags, simple checksums, and basic data masking; here it operates on the 32-bit unsigned values of A and B.
Can this calculator work with 64-bit hex values?
It is reliable for values up to roughly 15-16 significant digits, and its bitwise operators truncate inputs to 32 bits. For full 64-bit addresses or registers, results may lose precision, so verify them with a fixed-width tool.
What is the difference between hexadecimal, decimal, and binary?
They are the same numbers written in different bases: decimal is base 10, binary is base 2, and hexadecimal is base 16 using digits 0-9 and A-F. Hex is popular in computing because each hex digit maps neatly to four binary bits.
Related calculators