Hex Calculator
Convert numbers between decimal and hexadecimal in either direction.
Try an example
FF
About this calculator
What Is the Hexadecimal System?
Hexadecimal, or hex, is a number system with a base of 16. Like decimal (base 10) and binary (base 2), it is positional, but it needs sixteen digits: the numbers 0–9 followed by the letters A–F, where A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. Upper- and lowercase letters mean the same thing. Hex is popular in computing because one hex digit corresponds exactly to four binary digits, so long binary strings can be written in a much shorter form. This hex calculator performs addition, subtraction, multiplication and division and converts between hex and decimal.
Converting Hex to Decimal
Multiply each digit by a power of 16, counting from the right, and add. For 2F₁₆: 2 × 16 + 15 × 1 = 47. For 1A3₁₆: 1 × 256 + 10 × 16 + 3 = 419.
Worked Example
255 in decimal converts to FF in hexadecimal — the maximum value representable in 2 hex digits, matching one byte.
Converting Decimal to Hex
Divide by 16 repeatedly and record the remainders, writing any remainder of 10 or more as a letter. Reading the remainders from last to first gives the hex value. For 255: 255 ÷ 16 = 15 remainder 15, then 15 ÷ 16 = 0 remainder 15, so 255 = FF₁₆.
Hex and Binary
Because 16 = 2⁴, every hex digit maps to a group of four bits: 0 = 0000, 5 = 0101, A = 1010, F = 1111. The byte 11010110 splits into 1101 and 0110, which is D6 in hex. Going the other way is equally quick, which is why programmers prefer hex to long strings of ones and zeros. See the Binary Calculator for the base-2 side.
Where You Will See Hex
- Web colors: #FF6A4D encodes red, green and blue as three pairs of hex digits.
- Memory addresses and machine code in programming and debugging.
- MAC addresses, IPv6 addresses and hashes, usually written in hex.
- Character codes such as Unicode code points (U+00E9 for é).
A single hex pair covers 0 to 255, the range of one byte — the same range as a color channel. For general arithmetic in other bases, start with the Basic Calculator.
Worked example
255 in decimal converts to FF in hexadecimal — the maximum value representable in 2 hex digits (matching one byte).
Frequently asked questions
Where is hexadecimal commonly used?
Color codes in web design and design tools (like #FF5733), memory addresses, MAC addresses, and error codes are all commonly shown in hex, since it's a compact way to represent binary data.
How do I do hex arithmetic (addition, subtraction)?
Convert each hex number to decimal, perform the arithmetic in decimal, then convert the result back to hex using this calculator.
Why does hex use letters A-F?
Hexadecimal is base 16, which needs 16 distinct digits — after 0-9 are used up, the letters A through F represent the values 10 through 15.

