Hex Calculator

Hex Calculator. Enter Hex Value A and Hex Value B, pick an operation, and the Hex Calculator instantly returns your answer in hex, decimal, and binary. Since Pantone doesn't publish an official hex mapping, the hex to pantone converter instead compares your color against a curated approximation list.

Typing a long string of digits and letters into a hex calculator is the fastest way to add, subtract, multiply and divide hexadecimal numbers without converting every value by hand. Enter two values such as 7E5A and 2B9D, pick an operation, and you get the answer in hex, decimal and binary at once, so a quick bit of hex arithmetic never turns into a long afternoon of base conversion.

What Is a Hexadecimal Calculator and How Does It Work?

A hexadecimal calculator does ordinary arithmetic on numbers written in base 16. The hexadecimal system is a positional numeral system with a base of 16, which means it uses sixteen symbols: the digits 0 to 9 plus the letters A, B, C, D, E and F, standing for the values 10 to 15. Lowercase letters a to f work just as well, and a leading 0x simply tells software that the digits that follow are hex.

Each position in a hex number is worth a power of 16, the same way each position in a decimal number is worth a power of 10. The radix is the word for that base, and it is the reason a single hex digit always lines up with exactly four binary digits. That tidy mapping is why programmers, developers, software engineers, students and computer system designers prefer hexadecimal values over long runs of ones and zeros.

Among the common number systems in computing, which also include binary, decimal and octal, hexadecimal strikes the best balance between compactness and readability. Hexadecimal numbers need only a quarter as many digits as the equivalent binary numbers, and two hex digits describe exactly one byte, so hexadecimal numbers turn up in memory dumps, color codes, network addresses and file signatures. Reading hex numbers fluently takes practice, which is where a calculator that shows every result in several bases helps most.

Under the hood, the page does what you would do on paper: it converts each input to an integer, applies the operation, and converts the result back to hexadecimal values for display, adding the decimal and binary versions so you can sanity-check the answer. For anything beyond a couple of digits, a base 16 calculator is quicker and less error-prone than working from an addition table.

Hex Calculator & Converter: How to Use It

Using the tool takes a few seconds, and the same steps cover every one of the arithmetic operations on hexadecimal numbers, whether you are adding two short values or two very large ones.

  1. Type your first hexadecimal number into the first field, with or without the 0x prefix.
  2. Choose an operation: addition, subtraction, multiplication, division, or one of the bitwise operations covered below.
  3. Type the second value, then click the calculate button.
  4. Read the result in hex, decimal and binary, and copy whichever form your project needs.

Switch to the converter side when you only need to change a number's form rather than do arithmetic. In hex calculator mode you work with two operands; in conversion mode you enter a single value and choose the target base. Because converting never changes the quantity itself, only how it is written, a result you convert back should always return to the number you started with.

Hexadecimal Arithmetic: Addition, Subtraction, Multiplication and Division

All four arithmetic operations work the same way they do in decimal. The only differences are that a column rolls over at 16 instead of 10, and that digits above 9 are letters. The worked example below uses 7E5A and 2B9D, which are 32,346 and 11,165 in decimal.

Hex Addition and Carry

Hex addition proceeds from right to left. Add the two digits in a column plus any carry coming in; if the total reaches 16 or more, write down the remainder after dividing by 16 and carry the quotient to the next column. The carryover is always 0 or 1 when you add two numbers.

$$7\text{E5A}_{16} + 2\text{B9D}_{16} = \text{A9F7}_{16}$$
Hex Addition and Carry
Column (right to left)Digits plus carryDecimal sumDigit writtenCarry out
OnesA + D + 02371
Sixteens5 + 9 + 115F0
256sE + B + 02591
4,096s7 + 2 + 110A0

Reading the digits written from the bottom row to the top gives A9F7, which is 43,511 in decimal, exactly 32,346 + 11,165. A hex number adder does this column work instantly, which is a relief when the digits run to 16 or more.

Stacked column chart of each digit column when adding hex 7E5A and 2B9D, with column totals 23, 15, 25 and 10 and the carry into each column
Adding 7E5A and 2B9D column by column: any column that reaches 16 writes the remainder and carries 1.

Hex Subtraction and Borrowing

Hex subtraction mirrors decimal subtraction, except that when you borrow from the next column you borrow a group of 16 rather than 10. Subtracting 2B9D from 7E5A gives 52BD, or 21,181 in decimal. In the ones column, A (10) is smaller than D (13), so you borrow 16 from the next column: 10 + 16 − 13 = 13, which is D, and the column to its left gives up one unit. Computers often use the complement method instead, adding the two's complement of the second number, but the answer is identical.

Hex Multiplication and Division

For multiplication, multiply digit by digit, divide each product by 16, keep the remainder and push the quotient into the next column. Multiplying 7E5A by 2B9D gives 15869B32, which is 361,143,090 in decimal. Long products like this are exactly where a calculator earns its keep.

Division returns a quotient and a remainder. Dividing 7E5A by 2B9D gives a quotient of 2 and a remainder of 2720, because 2 × 2B9D = 573A and 7E5A − 573A = 2720; the calculator reports the remainder directly in hex, so you never have to repeat that borrowing by hand.

The key rule behind every one of these steps is the formula for the value of a hex digit string:

$$N = \sum_{i=0}^{k} d_i \times 16^{i}$$

Hex to Decimal and Decimal to Hex Conversion

Conversion is the other half of a good hex converter. Hex digits never change the number, only its form, so you can move between bases freely as long as you keep track of place values.

Hex to Decimal

To go from hex to decimal, multiply each digit by 16 raised to its position, counting from zero on the right, and add the results. For 7E5A, that means 7 × 163 + 14 × 162 + 5 × 16 + 10:

$$7 \times 4096 + 14 \times 256 + 5 \times 16 + 10 = 32{,}346$$

Each power of 16 is a column's weight: 1, 16, 256, 4,096, and so on. Remember to translate letters first, so that E counts as 14 and A counts as 10.

Waterfall chart building hexadecimal 7E5A into decimal 32,346 from the place values 28,672, 3,584, 80 and 10
Hex 7E5A converted to decimal by weighting each digit by its power of 16.

Decimal to Hex

To go from decimal to hex, divide by 16 repeatedly and collect the remainders. Take 2,024: dividing by 16 gives 126 remainder 8; 126 divided by 16 gives 7 remainder 14 (E); 7 divided by 16 gives 0 remainder 7. Reading the remainders from last to first gives 7E8. This also answers a common question such as how to write 255 in hexadecimal: 255 ÷ 16 is 15 remainder 15, so the answer is FF.

Hex to Binary and Binary to Hex

Converting hex to binary is the easiest of all because each hex digit is exactly four bits, sometimes called a nibble, and two nibbles make one byte. The digit C becomes 1100 and 9 becomes 1001, so C9 is 11001001. Going the other way, binary to hex means grouping bits in fours from the right and translating each group. Octal works similarly with groups of three bits, and the calculator's binary line shows the same four-bit groups for any hex value.

Checking a Firmware Buffer with a Hexadecimal Calculator

A firmware developer is placing a DMA receive buffer in the main SRAM of an STM32F405, which spans 0x20000000 to 0x2001FFFF according to the chip's reference manual. The linker map says the buffer starts at 0x2001A3C0 and the driver requests 0x5D40 bytes, which is 23,872 in decimal. Before flashing anything, the developer wants to know where the buffer ends.

The check is hex addition, so the two values go into the hexadecimal calculator as an addition: 2001A3C0 plus 5D40. The result comes back as 0x20020100, and the decimal line shows 537,002,240. That address is 0x100 bytes, exactly 256, beyond 0x20020000, the first address after the SRAM. The linker would never have flagged it, because the buffer is declared inside a section that is only checked at link time against a different memory region.

Checking a Firmware Buffer with a Hexadecimal Calculator
Buffer size (hex)Size (decimal)End addressVerdict against 0x20020000
0x5D4023,8720x20020100256 bytes past the top of SRAM
0x5C0023,5520x2001FFC064 bytes to spare

The developer reruns the same addition with one input changed, 0x5C00, and gets 0x2001FFC0. Subtracting that from 0x20020000 in the subtraction mode returns 0x40, so 64 bytes remain for the stack guard, and the calculator's hex and decimal lines confirm the overflow is gone. The next action is concrete: shrink the DMA length constant from 0x5D40 to 0x5C00, rebuild, and confirm the map file shows the buffer ending at 0x2001FFC0.

Hex Bitwise Calculator: AND, OR and XOR on Hex Numbers

A hex bitwise calculator performs logical operations on every bit of two values at once. Because each hex digit expands to four bits, you can read a mask or a flag set in compact notation while still seeing which individual bits are on or off.

Bitwise Operations on Hex Numbers

The common bitwise operations are AND, OR, XOR and NOT. With bitwise AND, a result bit is 1 only when both input bits are 1; OR sets a bit when either input has it; and XOR sets it when exactly one does. Take C9 (11001001) and 6B (01101011):

  • C9 AND 6B = 49 (01001001), useful for applying a mask to keep only selected bits.
  • C9 OR 6B = EB (11101011), useful for switching extra flags on.
  • C9 XOR 6B = A2 (10100010), useful for toggling flags and spotting which bits differ.

Working at the bit level like this is routine for debugging, building a bitmask for a hardware register, or checking that a flag was set the way you intended. Use the AND, OR and XOR lines to build bitmasks that set file permissions, switch interrupts on or off, or mimic logic gates in a register.

Bit grid showing hex C9 and 6B with their bitwise AND, OR and XOR results 49, EB and A2 across eight bit positions
Hex C9 and 6B compared bit by bit under AND, OR and XOR.

Bit Shifts: Left Shift and Right Shift

The bit shifts slide every bit sideways. A left shift moves bits toward the higher end and inserts zeros on the right, which multiplies by 2 for each place moved: C9 shifted left by 2 is 324, or 804 in decimal. A right shift moves bits toward the lower end and drops the least significant bit each time, which divides by 2 and discards the remainder: C9 shifted right by 3 is 19, or 25 in decimal.

Signed and Unsigned Hex Values

Whether a hex value is signed or unsigned depends on how your program interprets it, not on the digits themselves. In an 8-bit signed value, FF means −1 using two's complement, while the same FF is 255 when unsigned. A calculator shows the raw bits; deciding the sign convention is up to you.

Hex Number Adder for Large Hex Numbers

A hex number adder is especially valuable for large hex numbers, such as 64-bit addresses and keys, where a single slipped carry ruins the whole result. Think of it as a free online hexadecimal sum calculator that never tires: paste several hex numbers, one per line, and it totals them all. A hex adder like this also lets you verify a long column sum by totalling the same values in a different order.

Whatever tool you choose, check that it handles arbitrary lengths rather than silently rounding at 53 bits, because large hex numbers can exceed what standard floating point stores exactly. If the page accepts the 0x prefix, strip nothing; if it does not, paste only the digits.

Where Hexadecimal Numbers Are Used

Hexadecimal numbers are everywhere in computing because it is a compact, human-friendly view of binary data. Typical uses include:

  • Embedded systems and low-level programming: setting and clearing bits in hardware registers and reading memory addresses.
  • Networking: writing an IP address in hex (192.168.0.1 becomes C0A80001), reading an IP address out of a packet dump, or working out subnet masks one octet at a time.
  • Color: web and design tools write each RGB color as three hex pairs, such as #1B9E77 for a green. Each pair runs from 00 to FF, so a color channel has 256 levels, and a hex color like #FF0000 is pure red.
  • Text encoding: Unicode code points, ASCII codes and character codes are written in hex, and URLs use percent signs followed by two hex digits, so %20 is a space.
  • Cryptography and data serialization: encryption keys, hashes, protocols and packed binary formats are typically shown in hex, and many hashing and encryption algorithms are specified in it.

Anyone working with digital circuits, digital electronics or low-level code uses hex constantly, and the calculator's hex, decimal and binary lines make it quick to check addresses, colors and masks. That hexabulous time-saver only pays off once you trust the underlying place-value rules.

Hex Numbers Reference Table

This short lookup shows how a few useful numbers appear in decimal, hexadecimal and binary. It is a handy cross-check when you suspect a conversion is off.

Hex Numbers Reference Table
DecimalHexBinary
161010000
311F11111
1277F1111111
255FF11111111
256100100000000
4,095FFF111111111111

The pattern is clear: hex numbers made only of F digits are one less than a power of 16, and every extra hex digit adds exactly four bits.