Binary Translator

Hex Calculator

This hex calculator adds, subtracts, multiplies and divides hexadecimal numbers and applies AND, OR, XOR, NOT and bit shifts. Enter operands in hex, with or without 0x. For example FF + 1 is 100, and 0x20 ÷ 4 is 8.

Result (hex)

100

Decimal: 256

Binary: 100000000

Check in decimal: 255 + 1 = 256

Examples

  • 0x20 + 4 = 24 (32 + 4 = 36)
  • 0x20 - 4 = 1C (32 - 4 = 28)
  • 0x20 × 4 = 80 (32 × 4 = 128)
  • 0x20 ÷ 4 = 8 (32 ÷ 4 = 8 remainder 0)
  • F0 AND 3C = 30 (binary 110000)

Arithmetic in hexadecimal

Hex arithmetic carries at 16 instead of 10, so F + 1 is 10 (sixteen). The calculator converts the operands to integers, computes exactly, and writes the result back in hex, with the decimal and binary forms underneath so you can check it. Operands can be any size because the arithmetic is arbitrary precision.

Division gives a whole-number quotient and the remainder is shown in the check line; use Remainder (mod) to get the remainder as the result. Dividing by zero is reported as an error. With a negative operand the quotient is truncated toward zero and the remainder takes the sign of A.

Bitwise operations and shifts

AND, OR and XOR compare the operands bit by bit, and the result is padded to the length of the longer operand. They need non-negative operands, because negative values depend on a bit width. NOT flips every bit within the width you choose (8, 16, 32 or 64); the default is 32 bits, a common word size, and the operand must fit in it.

Shift left multiplies by a power of two and shift right divides by one, discarding the bits that fall off. The shift count B is read as hex and is limited to 4096 so a typo cannot freeze the page.

Negative results

Addition, subtraction and multiplication allow signs, and a negative result is written with a minus sign, for example 1 - 2 is -1. This is a signed magnitude display, not a two’s complement register value.

Frequently asked questions

What is 0x20 / 4?
8 in hex (8 in decimal): 0x20 is 32, and 32 ÷ 4 = 8.
What is FF + 1 in hex?
100, which is 256 in decimal; the F digits carry into a new digit.
Does the calculator accept lowercase and 0x?
Yes. ff, FF and 0xff are the same value.
Why does NOT need a width?
NOT flips leading zeros too, so the answer depends on how many bits you count: NOT of the same value differs between 8 and 32 bits.