Hexadecimal Calculator

Convert between hexadecimal, decimal, binary, and octal number systems. Perform arithmetic operations on hex numbers.

For learning and homework help — verify critical calculations independently.

Reviewed by CalculatorDrive Math Editorial Board · Last updated

Calculator

Enter hex value (0-9, A-F). Prefixes 0x or # are optional.

Enter a hexadecimal value to convert, or perform arithmetic operations on hex numbers.

The short answer

Hexadecimal (base 16) uses digits 0-9 and letters A-F, where each position represents a power of 16. FF in hex equals 15×16 + 15 = 255 in decimal — the largest value a single byte can hold. Programmers use hex because it maps cleanly onto binary: one hex digit always equals exactly 4 bits, so two hex digits represent a full byte.

Key takeaways

  • Two hex digits equal one byte (8 bits) — a value from 00 to FF (0 to 255) — which is why memory addresses, byte values, and color codes are almost always shown in hex.
  • Converting hex to binary is mechanical: replace each hex digit with its 4-bit binary equivalent and join them together.
  • Hex arithmetic follows the same carrying and borrowing logic as decimal arithmetic, just with a base of 16 instead of 10.
  • Web colors (#RRGGBB) pack three byte values — red, green, blue — into six hex digits, two per color channel.

Hex digit values (0-F)

HexDecimalHexDecimal
A10D13
B11E14
C12F15

Converting decimal to hex

202 ÷ 16 = 12 remainder 10 → A

12 ÷ 16 = 0 remainder 12 → C

Read remainders bottom to top: CA

So decimal 202 equals hex CA. Checking in reverse: C×16 + A = 12×16 + 10 = 192 + 10 = 202 — confirming the conversion.

Worked example: hex addition

3A + 1F

A (10) + F (15) = 25 = 1×16 + 9 → write 9, carry 1

3 + 1 + carry 1 = 5

Result: 59

Checking in decimal: 3A = 58, 1F = 31, and 58 + 31 = 89, which is 5×16 + 9 = 0x59 — matching the hex arithmetic exactly. The only real difference from decimal addition is that a carry happens once a column reaches 16, not 10.

Common mistakes to avoid

  • Carrying at 10 out of habit instead of 16 — a hex column carries once its value reaches 16, not 10 like decimal.
  • Assuming a single hex digit is one bit — it always represents 4 bits, since 16 = 2⁴.
  • Dropping a leading zero on a fixed-width byte or color channel — 0x0A and 0xA are the same value, but a two-digit byte display expects 0A, not A.
  • Mixing digit case inconsistently — hex is case-insensitive (a = A = 10), but sticking to one case avoids visual confusion in longer values.

Frequently Asked Questions

What is hexadecimal (base 16)?

Hexadecimal uses digits 0–9 and letters A–F (for 10–15). Each position is a power of 16. FF hex equals 15×16 + 15 = 255 decimal.

Why do programmers use hex?

One hex digit maps to exactly four binary bits, making long binary strings easier to read. Memory addresses and color codes often appear in hex.

How do you convert decimal to hex?

Repeatedly divide by 16 and record remainders from bottom to top. Remainders 10–15 become A–F.

What is the link between hex and RGB colors?

Web colors use six hex digits: two for red, two for green, two for blue. #FF5733 means full red, partial green, and less blue.

How do I use this hex calculator?

Enter a hex or decimal value, choose conversion or arithmetic, and click Calculate to see results in both bases.

How much memory does 2 hex digits represent?

Two hex digits represent exactly one byte (8 bits), since each hex digit covers 4 bits. That is why byte values are almost always written as two-digit hex, from 00 to FF (0 to 255 in decimal) — the most compact way to show a full byte without losing information.

More math calculators