More games at WuGames.ioSponsoredDiscover free browser games — play instantly, no download, no sign-up.Play

Hex Calculator

Programmer hex calculator: AND/OR/XOR/NOT, shifts and arithmetic with selectable 8/16/32/64-bit or BigInt width, two's-complement signed output, hex/dec/binary.

How to Calculate Hexadecimal?

Hexadecimal (base-16) is a number system that uses 16 symbols: 0-9 and A-F. It's commonly used in computer programming and digital systems. Each position represents a power of 16.

Converting Hexadecimal to Decimal:

  • Write down the hexadecimal number
  • Multiply each digit by 16 raised to the power of its position (from right to left, starting at 0)
  • Add all the results together

0xFF = 15×16¹ + 15×16⁰ = 240 + 15 = 255

Converting Decimal to Hexadecimal:

  • Divide the decimal number by 16
  • Write down the remainder (convert 10-15 to A-F)
  • Continue dividing the quotient by 16 until it becomes 0

255 ÷ 16 = 15 remainder 15 → F

15 ÷ 16 = 0 remainder 15 → F

Result: 0xFF

Hexadecimal reference table

DecimalHexadecimalBinary
00x00000
10x10001
100xA1010
150xF1111
160x1010000
2550xFF11111111
2560x100100000000

About this hex calculator

Enter two numbers in any combination of bases — hex, decimal, or binary — pick an operation, choose a bit width, and the calculator returns the result simultaneously in hex, unsigned decimal, signed decimal and binary. The math core uses BigInt, so in Arbitrary (BigInt) mode very large values like 0xFFFFFFFFFFFFFFFF work without precision loss (0xFFFFFFFFFFFFFFFF + 1 = 0x10000000000000000). The bit-width selector (8/16/32/64-bit) makes bitwise operations (AND, OR, XOR, NOT, shifts) wrap inside a fixed register exactly like C, Rust, or masked Python: NOT 0xFF in 8-bit gives 0x00, and negative results are shown both as proper two's-complement hex and as a signed decimal. Everything runs in your browser — no inputs are uploaded.

Frequently Asked Questions

Read the hex digits from right to left, multiplying each by an increasing power of 16. For 0xFF: F×16¹ + F×16⁰ = 15·16 + 15·1 = 240 + 15 = 255. For longer values like 0x1A2B: 1·16³ + 10·16² + 2·16¹ + 11·16⁰ = 4096 + 2560 + 32 + 11 = 6699. The calculator does the conversion in one step — pick 'Hex' as the input base, type the value, and the decimal result shows underneath.

Repeatedly divide the decimal number by 16, recording each remainder. The remainders read bottom-to-top form the hex value, with 10–15 written as A–F. Example for 255: 255 ÷ 16 = 15 remainder 15 (F); 15 ÷ 16 = 0 remainder 15 (F). Read bottom-to-top: FF. So 255 = 0xFF. The calculator converts in either direction — pick the source base on the input dropdown and the result appears in all three bases.

Bitwise AND, OR, XOR operate on the binary representations of the inputs, one bit at a time. 0xFF AND 0x0F: in binary 11111111 AND 00001111 = 00001111 = 0x0F (keeps only the low nibble). 0xA0 OR 0x0B: 10100000 OR 00001011 = 10101011 = 0xAB (combines bits). 0xFF XOR 0x0F: 11111111 XOR 00001111 = 11110000 = 0xF0 (flips bits where the second operand has 1s). These are the building blocks of bit-mask programming and color-channel tricks.

Left shift by n moves all bits left by n positions and fills the right with zeros — equivalent to multiplying by 2ⁿ. 0x0F << 4 = 0xF0 (a one-nibble left shift). Right shift by n moves bits right and discards what falls off the end — equivalent to integer-dividing by 2ⁿ. 0xFF >> 4 = 0x0F. Shifts are how you pack and unpack RGB color channels (red = (color >> 16) & 0xFF), parse binary file formats, and implement fast multiplies/divides by powers of two.

Each pair of hex digits encodes a value 00–FF (0–255), giving the intensity of one color channel. #FF0000 is pure red (R=255, G=0, B=0); #00FF00 is pure green; #FFFFFF is white. Three bytes pack into six hex digits exactly, which is why the format is universal in CSS, design tools, and graphics APIs. Using hex instead of decimal keeps each channel visually distinct (#FF6347 vs rgb(255, 99, 71)) and makes bit-masking each channel trivial.

No. 0x10 is hexadecimal sixteen — the '0x' prefix tells the reader (and the compiler) that the digits are base-16. Plain 10 is decimal ten. The same digits can mean different values depending on the base: 10 in binary is 2, 10 in hex is 16, 10 in decimal is 10. The calculator's input dropdown next to each number lets you state the base explicitly, so there is never ambiguity about how a value is interpreted.

Yes. Set the bit-width dropdown to Arbitrary (BigInt) and arithmetic has no fixed width limit: 0xFFFFFFFFFFFFFFFF + 1 = 0x10000000000000000 (17 hex digits), and you can multiply or shift values far beyond 256 bits without precision loss. If you instead pick a fixed width (8/16/32/64-bit) the result is masked to that register size and wraps around — exactly what a uint8_t/uint32_t/uint64_t would do in C or Rust.

On a real CPU there is no 'minus' bit — a negative value is stored in two's complement inside a fixed-width register, so the answer depends entirely on the bit width. Choose 8/16/32/64-bit and the tool masks the result to that width: NOT 0xFF in 8-bit = 0x00, NOT 0x00 in 8-bit = 0xFF, and 5 − 10 in 32-bit shows the unsigned hex 0xFFFFFFFB alongside the signed decimal −5. In Arbitrary (BigInt) mode there is no register to wrap into, so NOT and subtraction can produce a value shown with an explicit minus sign instead of two's complement. The Signed decimal field always tells you how a fixed-width result is interpreted as a signed integer.

Match the width to the register or type you are reasoning about: 8-bit for a byte or uint8_t, 16-bit for a short, 32-bit for a typical int, 64-bit for a long/pointer, or Arbitrary (BigInt) for exact big-number math with no wrap. Overflow wraparound means a result that does not fit the chosen width keeps only the low bits: 0xFF + 1 in 8-bit = 0x00 (it wrapped past 255 back to 0), and 0xFFFFFFFF + 1 in 32-bit = 0x00000000. This is the behavior firmware, embedded, and reverse-engineering work depends on, and it matches C/Rust integer math and Python with an explicit & mask.

Memory addresses are usually printed in hex (a pointer like 0x7fff5fbff7c0 is easier to scan than its 13-digit decimal form). Bit flags and permission masks use hex constants (Unix file modes like 0644, register flag bits like 0x80000000). Cryptography hashes and UUIDs are shown in hex. Color values in CSS, asset IDs in game engines, opcodes in disassemblers, and error codes in Windows (0x80070005 'access denied') are all hex. This calculator is designed for the kinds of arithmetic you do while debugging or reading documentation on any of those.
Hex Calculator — Programmer hex calculator: AND/OR/XOR/NOT, shifts and arithmetic with selectable 8/16/32/64-bit or BigInt width, two's-c
Hex Calculator