Hex Calculator

Add, subtract, multiply, divide, AND, OR and XOR hexadecimal numbers — with instant conversion to decimal, binary and octal.

Hex arithmetic

Results update live as you type.

base 16
0x
arithmetic / bitwise
base 16 (ignored for NOT)
0x
decimal
source radix
RRGGBB
#
OperationA + B
Live calculation

Hex result

0x10E

FF + 0F = 0x10E · 270 in decimal

Decimal

270

base 10

Binary

100001110

base 2

Octal

416

base 8

Bits used

9

significant binary digits

Binary representation (lower 16 bits) bit 15 → bit 0
MSBLSB
DecimalHexBinaryUse
10A1010first letter digit
15F1111nibble max
255FF11111111byte max (8-bit)
4 095FFF12 ones12-bit max
65 535FFFF16 onesword max (16-bit)
16 777 215FFFFFF24 onesRGB max

The Method

How hex arithmetic works

Hexadecimal is a positional number system with base 16. Each digit position represents a power of 16, so the hex number 2F means 2 × 16¹ + 15 × 16⁰ = 47. To add, subtract, multiply or divide hex numbers, convert each digit to decimal, perform the operation, then convert the result back — exactly what this calculator does. Bitwise operators (AND, OR, XOR, NOT) operate on the underlying binary representation, where each hex digit corresponds to exactly four bits.

Working for FF + 0F

0xFF + 0x0F = 0x10E (255 + 15 = 270)
A hex input (255)
B hex input (15)
R result (270)
bits width (9)

About This Tool

What Is a Hex Calculator?

A hex calculator — also called a hexadecimal calculator or base-16 calculator — performs arithmetic and bitwise operations directly on hexadecimal numbers. Enter two hex values, pick an operation, and the calculator returns the result in hex, decimal, binary and octal simultaneously, along with a live bit-level view of the answer.

Hexadecimal is the everyday language of computing. Memory addresses, MAC addresses, IPv6 addresses, GUIDs, machine code, file hashes (MD5/SHA), and CSS colours are all written in hex because each hex digit maps cleanly to four binary bits. Two hex digits encode a single byte (0x00–0xFF, or 0–255 in decimal), and six hex digits encode the full 24-bit RGB colour space (0x000000–0xFFFFFF, or 16,777,216 colours).

This calculator also includes a base converter (hex ↔ decimal ↔ binary ↔ octal) and a CSS colour decoder that breaks any hex colour into its red, green and blue components. All calculation runs locally in your browser using IEEE 754 double-precision integers — accurate to 2⁵³ − 1 (9 quadrillion). Bitwise operators use 32-bit integer semantics, matching the behaviour of JavaScript, C and most modern languages.

Use this free hex calculator for embedded development, low-level debugging, learning binary arithmetic, decoding colours, or homework. No sign-up, no tracking — everything is computed client-side.

Full Arithmetic

Add, subtract, multiply and divide hexadecimal numbers with carry handling.

Bitwise Ops

AND, OR, XOR, NOT — using 32-bit integer semantics like C / JavaScript.

Base Converter

Convert any value between hex, decimal, binary and octal in one step.

Live Bit View

See exactly which bits are set in the result — 16-bit visual map.

Colour Decoder

Break any CSS hex colour into its 8-bit R, G, B components instantly.

100% Private

All computation is client-side — no data ever leaves your browser.

How to Use This
Hex Calculator

From hex arithmetic to colour decoding — every result in seconds.

1

Enter Hex Values

Type your two hexadecimal numbers using digits 0–9 and letters A–F. Case doesn't matter — the calculator accepts both FF and ff. The 0x prefix is implied; just enter the digits.

2

Pick an Operation

Choose arithmetic (+, −, ×, ÷) or bitwise (AND, OR, XOR, NOT). Bitwise NOT only uses A and ignores B. Division returns an integer quotient — use the base converter for fractional results.

3

Read the Multi-Base Result

The summary card shows your answer in hex, decimal, binary and octal simultaneously — useful when matching values between code, datasheets, and debuggers.

4

Inspect the Bit Map

The 16-bit visual map lights up every set bit from MSB (bit 15) on the left to LSB (bit 0) on the right — ideal for understanding masks, flags, and binary arithmetic at a glance.

5

Convert Between Bases

Use the base converter to translate any value between hex, decimal, binary and octal. Just type the value and choose its source base.

6

Decode CSS Colours

Drop any #RRGGBB colour into the decoder to see its red, green and blue channels live — and a colour swatch preview alongside.

Frequently Asked Questions

Everything you need to know about hexadecimal numbers, bitwise operations, and how to interpret your result.

Hexadecimal (base 16) uses sixteen digits: 0–9 and A–F, where A=10, B=11, C=12, D=13, E=14, F=15. Each hex digit represents exactly 4 bits (a nibble), so two hex digits perfectly encode a single byte (0x00–0xFF, or 0–255 decimal). This is why hex is the natural language of computer memory, colours, MAC addresses and machine code.

Add column by column from right to left, just like decimal — but carry whenever the column sum reaches 16. For example FF + 1 = 100 (F + 1 = 16, which is written 10 in base 16, so you write 0 and carry 1; then F + 1 + carry = 10 again). The calculator does the heavy lifting and shows the result in all four bases simultaneously.

0x is a prefix used in C, JavaScript, Python and many other programming languages to indicate that the following digits should be interpreted as hexadecimal. So 0xFF means hex FF, which equals 255 in decimal. Other common notations include &H (BASIC), $ (Pascal / assembly), and a trailing h (e.g. FFh in x86 assembly).

A CSS hex colour like #1A2B3C encodes three bytes: red = 0x1A (26), green = 0x2B (43), blue = 0x3C (60). Each byte ranges 0–255, so the full colour space contains 16,777,216 (256³) distinct colours. The shorthand #ABC expands to #AABBCC — each digit is duplicated.

Computers think in binary, but binary is verbose — 11111111 is a single byte. Hex compresses this perfectly: every 4 bits maps to a single hex digit, so the same byte becomes FF. This makes memory dumps, MAC addresses, GUIDs, hashes and machine code drastically more readable for humans without losing any information.

Arithmetic (+, −, ×, ÷) treats hex numbers like normal numbers and produces a numeric result. Bitwise operators (AND, OR, XOR, NOT) work on the binary representation bit by bit: AND is 1 only if both bits are 1; OR is 1 if either bit is 1; XOR is 1 if exactly one is 1; NOT flips every bit. Bitwise operations are the backbone of masking, flags, encryption and low-level graphics.

Arithmetic operations use IEEE 754 double-precision and are exact up to 2⁵³ − 1 ≈ 9 × 10¹⁵ (about 9 quadrillion, or 13 hex digits). Bitwise operators use 32-bit integer semantics — they will wrap values larger than 0xFFFFFFFF (4,294,967,295). For genuinely huge values, use the Big Number Calculator instead.

In additive RGB colour, more light = brighter. #FFFFFF means full red (255), full green (255), full blue (255) — every channel at maximum, which produces white. #000000 means zero of every channel — no light at all, which is black. Shades of grey are equal values, e.g. #808080 is mid-grey.

8-bit: 0xFF = 255 (one byte). 16-bit: 0xFFFF = 65,535 (one "word"). 32-bit: 0xFFFFFFFF = 4,294,967,295 (often called UINT32_MAX). 64-bit: 0xFFFFFFFFFFFFFFFF = about 1.8 × 10¹⁹ (UINT64_MAX). These maxima appear constantly in low-level programming as overflow boundaries and sentinel values.

XOR (exclusive OR) returns 1 only when exactly one of two bits is 1. It has a fascinating property: A XOR B XOR B = A, which means XOR is reversible. This makes it the building block of stream ciphers, error detection (parity bits), swap without a temp variable, and graphics blitting for cursor draws.