Hex Calculator

Hexadecimal is base 16, with digits 0–9 and A–F, where A = 10 and F = 15. FF in hex is 15 × 16 + 15 = 255, and FF + 1 = 100 in hex (256 in decimal). Each hex digit equals exactly four binary digits, so 2F = 0010 1111.

Inputs

Result
–

Results are calculated in your browser for convenience. Double-check important figures before relying on them.

How hexadecimal works

Hex places are powers of 16: 1, 16, 256, 4,096. The digits A to F stand for 10 to 15. So 2F = 2 × 16 + 15 = 47, and 1A3 = 256 + 160 + 3 = 419. To convert decimal to hex, divide by 16 repeatedly and read the remainders from bottom to top: 419 ÷ 16 = 26 r 3, 26 ÷ 16 = 1 r 10 (A), 1 ÷ 16 = 0 r 1, giving 1A3.

Why programmers use hex

HexBinaryDecimal
000000
910019
A101010
F111115
FF1111 1111255

Because one hex digit is four bits, hex is a compact way to write binary: a byte is just two hex digits. It appears in colour codes (#FF8800 is red 255, green 136, blue 0), memory addresses, MAC addresses, error codes and character encodings.

Hex arithmetic examples

  • FF + 1 = 100 (255 + 1 = 256).
  • A5 + 5B = 100 (165 + 91 = 256).
  • 1F × 2 = 3E (31 × 2 = 62).
  • FF AND 0F = 0F, which keeps only the low four bits.

Use the binary calculator to see the bits, and the Base64 encoder or URL encoder for related encodings.

Complete guide to the Hex Calculator

How to use the Hex Calculator, step by step

  1. Choose the base of the numbers you type.
  2. Enter the first number in hex.
  3. Choose an operation.
  4. Read the result in hex, decimal and binary.

Common mistakes to avoid

  • Forgetting that A to F are 10 to 15.
  • Treating hex as decimal.
  • Dropping leading zeros in fixed-width values.

Key terms explained

Hexadecimal
Base 16.
Nibble
Four bits, one hex digit.
0x prefix
A marker for a hex number.
Color code
Three hex bytes for red, green and blue.

Frequently asked questions

How do I convert hex to decimal?

Multiply each digit by its power of 16 and add. For 2F: 2 × 16 + 15 = 47.

What does FF mean in hex?

FF is 255 in decimal, the largest value of a single byte, and 11111111 in binary.

How do I read a hex colour code?

A code such as #FF8800 has three bytes: red FF (255), green 88 (136) and blue 00 (0). Larger values mean more of that colour.

Why are letters used in hex?

Base 16 needs 16 single symbols, but we only have 10 digits. The letters A to F stand for 10 to 15.

How do I convert hex to binary?

Replace each hex digit with its four-bit binary value. For 2F: 2 = 0010 and F = 1111, so 00101111.

Is hex case-sensitive?

No. ff, FF and Ff mean the same number. This calculator accepts either and may show results in capitals.

What is the 0x prefix?

0x is a common marker, used in many programming languages, to show that the number that follows is hexadecimal. This calculator accepts it.

Related calculators

Guides worth reading