Skip to content

Hex Calculator

Hex arithmetic (add, subtract, multiply, divide) and conversions between hexadecimal, decimal, binary, and octal.

Hex Arithmetic

= E23

Decimal: 1,015 + 2,604 = 3,619

Hex to Decimal / Binary / Octal

Hex:
Decimal48,879
Binary1011111011101111
Octal137357

Decimal to Hex / Binary / Octal

Decimal:
HexadecimalFF
Binary11111111
Octal377

Something wrong or missing? Tell us — we read every report and fix issues fast.

Hexadecimal Number System

Hexadecimal (base-16) is a compact way to represent binary data. Each hex digit maps to exactly 4 binary bits, making conversions between hex and binary straightforward. One byte (8 bits) is always two hex digits.

Hex Digits

HexDecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111

Hex Arithmetic

Hex arithmetic works exactly like decimal arithmetic but in base 16. You can add, subtract, multiply, and divide hexadecimal numbers. The calculator converts to decimal internally, performs the operation, and converts back.

Examples

  • 3F7 + A2C = E23 (1015 + 2604 = 3619)
  • FF × 2 = 1FE (255 × 2 = 510)
  • 100 − 1 = FF (256 − 1 = 255)

Common Hex Values

HexDecimalSignificance
FF255Max unsigned byte
FFFF65,535Max unsigned 16-bit
FFFFFFFF4,294,967,295Max unsigned 32-bit
7F127Max signed byte
80128High bit set (byte)
DEADBEEF3,735,928,559Common debug marker

Hex in Web Development

CSS color codes use hexadecimal: #RRGGBB where each pair is 00-FF (0-255). For example, #FF0000 is pure red (R=255, G=0, B=0), and #808080 is medium gray (128, 128, 128).

Related Calculators

Frequently Asked Questions

How do I convert hex to decimal?

Multiply each hex digit by 16 raised to its position, counting from 0 on the right, then add the results. For 2F, 2 x 16 + 15 x 1 = 47, because F stands for 15. The letters A to F stand for the values 10 to 15, so FF is 15 x 16 + 15 = 255.

How do I convert decimal to hex?

Divide the number by 16 repeatedly, write down each remainder, then read the remainders from last to first. For 255, 255 / 16 = 15 remainder 15, and 15 / 16 = 0 remainder 15. Both remainders are 15, written F, so 255 in hex is FF. Remainders from 10 to 15 become the letters A to F.

How do you convert hex to binary?

Replace each hex digit with its 4-bit binary group. A3 in hex becomes 1010 0011 in binary, because A is 1010 and 3 is 0011. This works because one hex digit holds exactly 4 bits, so two hex digits make one byte. To convert back, split the binary into groups of 4 from the right.

What does 0x mean before a number?

The 0x prefix marks a number as hexadecimal. 0xFF means FF in hex, which is 255 in decimal. The prefix is used in C, Python, JavaScript and most other programming languages, while CSS color codes use a # sign instead, as in #FF5733. Hex digits are not case-sensitive, so 0xff and 0xFF are the same value.