Hex Calculator
Add, subtract, multiply, divide, and inspect hexadecimal values with instant results, base conversions, and step-by-step explanations.
Detected as Hexadecimal — 8-bit width, 1 byte
Related Hex Tools
- Hex to DecimalConvert base-16 values like FF into decimal numbers like 255.
- Decimal to HexConvert a decimal number into its hexadecimal equivalent.
- Hex to BinaryConvert hex digits into 4-bit binary groups.
- Binary to HexConvert a binary string into compact hexadecimal.
- Hex to OctalConvert hex values into base-8 octal.
- Octal to HexConvert an octal value into its hexadecimal equivalent.
- Hex to Base36Convert hex into the compact base36 alphanumeric system.
- Base36 to HexConvert a base36 value into its hexadecimal equivalent.
- Hex to Base2Convert hex into base2 (binary) digits.
- Base2 to HexConvert a base2 value into its hexadecimal equivalent.
- Hex to Base8Convert hex into base8 (octal) digits.
- Base8 to HexConvert a base8 value into its hexadecimal equivalent.
- Hex to Base10Convert hex into base10 (decimal) digits.
- Base10 to HexConvert a base10 value into its hexadecimal equivalent.
- Hex to Base16Normalize a hex value — base16 and hex are the same system.
- Base16 to HexNormalize a base16 value into standard hex formatting.
- Hex to Base32Encode hex bytes as RFC 4648 Base32 (TOTP secrets, Crockford IDs).
- Base32 to HexDecode a Base32 string back into raw hex bytes.
- Hex to Base64Encode hex bytes as RFC 4648 Base64 (data URIs, JWTs).
- Base64 to HexDecode a Base64 string back into raw hex bytes.
- Base12 to HexConvert a base12 (dozenal) value into its hexadecimal equivalent.
- Hex CalculatorAdd, subtract, multiply, and divide hex values directly.
- Hex Addition CalculatorAdd two hexadecimal numbers with a full carry-by-carry breakdown.
- Hex Subtraction CalculatorSubtract hex values with a full borrow-by-borrow breakdown.
- Hex Multiplication CalculatorMultiply hex values with a full partial-product breakdown.
- Hex Division CalculatorDivide hex values and see the quotient and remainder.
- Hex Modulo CalculatorFind the remainder of dividing one hex value by another.
- Hex Average CalculatorFind the average of two hex values.
- Hex Power CalculatorRaise a hex value to a power.
- Hex Square CalculatorSquare a hex value.
- Hex Square Root CalculatorFind the square root of a hex value.
- Hex Percentage CalculatorFind what percentage one hex value is of another.
- Hex to Negative DecimalInterpret a hex bit pattern as a signed decimal value.
- Negative Decimal to HexConvert a negative decimal number into two's-complement hex.
- Hex Two's Complement CalculatorFlip a hex value's sign using two's complement.
- Hex One's Complement CalculatorInvert every bit of a hex value.
- Hex Absolute Value CalculatorFind the absolute value of a signed hex bit pattern.
- Hex Signed Integer CalculatorRead hex as an int8/int16/int32/int64 signed value.
- Signed Integer to HexEncode a signed integer type as its hex bit pattern.
- Hex Unsigned Integer CalculatorRead hex as a uint8/uint16/uint32/uint64 value.
- Hex Negative Number CalculatorCheck whether a hex value is negative at a given bit width.
Introduction to the Hexadecimal System
Hexadecimal is a base-16 number system that uses sixteen digits: 0 through 9, then A through F for 10 through 15. Each hex digit maps to exactly four binary bits, so two hex digits represent one byte — that's why hex shows up everywhere in programming, memory addresses, color codes, and networking.
Watch: How Hexadecimal Works
“Understanding Binary, Hexadecimal, Decimal (Base-10), and more” by Corey Schafer on YouTube.
What Is a Hexadecimal Calculator?
A hex calculator performs arithmetic — addition, subtraction, multiplication, and division — directly on base-16 values, and converts the result into decimal, binary, and octal at the same time. It checks manual hex math, helps with debugging, and converts between number systems without doing the base conversion by hand.
How Does the Calculator Work?
- Enter one or two hex values.
- Choose an operation to calculate, or switch to Convert / Inspect for one value.
- Read the result in hex, decimal, binary, and octal, plus a step-by-step breakdown.
Hexadecimal Arithmetic, Explained
Addition
1A3 + 2F = 1D2
1 A 3
+ 0 2 F
-------
1 D 2| Step | Description | Result |
|---|---|---|
| Convert 1A3 | (1 x 256) + (10 x 16) + 3 | 419 |
| Convert 2F | (2 x 16) + 15 | 47 |
| Add | 419 + 47 | 466 |
| Convert back | decimal 466 to hex | 1D2 |
Subtraction
1A3 - 2F = 174
1 A 3
- 0 2 F
-------
1 7 4Base is 16, so borrowing one from the next place adds 16 to the current place before subtracting.
Multiplication
A x 5 = 32
A hex = 10 decimal 10 x 5 = 50 decimal 50 decimal = 32 hex
Division
1D2 / A = 2E remainder 6
1D2 hex = 466 decimal A hex = 10 decimal 466 / 10 = 46 remainder 6 46 decimal = 2E hex
Practical Uses
Reading Memory Dumps and Log Output
Debuggers, disassemblers, and crash logs print addresses and register values in hex because it maps cleanly onto bytes. A stray 0x7F or 0xFFFFFFFF in a log is easier to trace back to its source once you can convert it on the spot.
0x7F = 127
Picking and Checking Colors
Every CSS color is a hex triplet under the hood. Designers hand off swatches as hex, developers wire them into RGB or HSL for animations — converting between the two happens constantly.
#2563EB = rgb(37, 99, 235)
Networking and Firmware Bytes
IP addresses, MAC addresses, CRC checksums, and firmware images are stored and transmitted as raw bytes, which tools display in hex because it's four times shorter than binary and lines up one digit per nibble.
192.168.1.1 = 0xC0A80101
Common Hex Values at a Glance
These bit-width boundaries come up so often in programming that it's worth recognizing them on sight instead of converting each time.
| Hex | Decimal | Why it matters |
|---|---|---|
| 0x00 | 0 | All bits clear |
| 0x0F | 15 | Low nibble fully set — a common bitmask |
| 0x7F | 127 | Largest positive signed 8-bit value |
| 0x80 | 128 (unsigned) / -128 (signed) | Smallest signed 8-bit value in two's complement |
| 0xFF | 255 | All 8 bits set — largest unsigned byte |
| 0xFFFF | 65535 | All 16 bits set — max unsigned short |
Why Use This Hex Calculator
- Runs entirely in your browser — no sign-up, no upload, nothing sent to a server
- Catches arithmetic mistakes in manual hex math before they reach code or hardware
- Shows hex, decimal, binary, and octal for every result at once, so you don't reach for a second tool
- Arbitrary-precision engine handles values well past 64-bit without overflowing
- Every step of the calculation is shown, not just the final answer
Frequently Asked Questions
Why does hexadecimal use the letters A through F?
Base 16 needs sixteen distinct symbols per digit. Digits 0-9 only cover ten of them, so hex borrows A-F for the values 10-15. C, for instance, is a single digit standing in for decimal 12.
How do I convert hex to decimal by hand?
Multiply each digit by 16 raised to its position (counting from 0 on the right) and add the results. 9B = (9 x 16^1) + (11 x 16^0) = 144 + 11 = 155.
How do I convert hex to decimal in JavaScript or Python?
JavaScript: parseInt("9B", 16). Python: int("9B", 16). Both read a hex string and return its decimal value — useful when you want to check a manual conversion or parse hex from user input.
What does the 0x prefix mean, and are there other hex notations?
0x marks a literal as hexadecimal in most languages (C, JavaScript, Python). Assembly and some hardware docs instead use an "h" suffix, like 9Bh — same value, different convention.
Can hex values be negative?
Hex digits themselves don't carry a sign — negative values only exist once you interpret the bits with a signed encoding like two's complement at a fixed bit width. Switch to Convert / Inspect above to see a value's signed and unsigned reading side by side.
Why does hex subtraction borrow 16 instead of 10?
Borrowing pulls one unit from the next column, and in base 16 that unit is worth 16 in the current column — not 10 like in decimal. F - A still works the same way, it just adds 16 before subtracting when a digit runs short.
Does this calculator handle numbers bigger than 64-bit?
Yes. The engine uses arbitrary-precision arithmetic rather than fixed-width integers, so values well beyond a standard 64-bit range still add, subtract, multiply, and divide correctly.
Where does hex show up outside of programming?
CSS and design tools use it for color codes (#2563EB), networking tools use it for MAC addresses and packet dumps, and file formats use it in hex editors to show raw bytes that would be unreadable as plain decimal.