Decimal (Base 10) to Hexadecimal (Base 16) Converter

Convert decimal numbers to hexadecimal.

FF

255 (base 10) = FF (base 16)

Digits in base 10: 0 to 9. Digits in base 16: 0 to 9 and A to F.

How to convert Decimal to Hexadecimal

Every positional number system works the same way: a digit is worth its own value times the base raised to the power of its position. In base 10 the place values, from the right, are 100 = 1, 101 = 10, 102 = 100 and so on.

To get from decimal to base 16, divide the number by 16 over and over. Every remainder is one digit of the answer, starting with the last digit, so you read the remainders from the bottom up.

The method

divide by 16, keep the remainder, repeat until the quotient is 0the answer is the remainders read from last to firstdigits in base 10: 0 to 9digits in base 16: 0 to 9 and A to F

Worked example 1: 45 from decimal to hexadecimal

45 ÷ 16 = 2 remainder 13 (D)2 ÷ 16 = 0 remainder 2Read the remainders from the bottom up: 2D45 (base 10) = 2D (base 16)

Letters stand for values from 10 up: A = 10, B = 11, C = 12 and so on. Remainders come out last digit first, which is why you read them from the bottom up.

Worked example 2: 255 from decimal to hexadecimal

255 ÷ 16 = 15 remainder 15 (F)15 ÷ 16 = 0 remainder 15 (F)Read the remainders from the bottom up: FF255 (base 10) = FF (base 16)

Worked example 3: 1000 from decimal to hexadecimal

1,000 ÷ 16 = 62 remainder 862 ÷ 16 = 3 remainder 14 (E)3 ÷ 16 = 0 remainder 3Read the remainders from the bottom up: 3E81000 (base 10) = 3E8 (base 16)

Need the other direction? Open the Hexadecimal to Decimal converter.

Decimal to Hexadecimal examples

The decimal number 255 is written 255 in decimal and FF in hexadecimal.

Common Decimal to Hexadecimal values
DecimalHexadecimal
11
22
77
88
10A
15F
1610
3220
6440
10064
255FF
10003E8

Where Decimal to Hexadecimal comes up

Decimal is the base 10 system everyone learns first, with the digits 0 to 9. It is the form people read: prices, measurements, ages and IDs. It is also the base we calculate in by hand, which is why the worked steps on this page pass through decimal.

Hexadecimal (base 16) uses 0 to 9 and A to F, and each hex digit stands for exactly four bits, so one byte is always two hex digits. You see it in web colours like #FF8800, memory addresses, MAC addresses, hash values and byte dumps.

Going to a larger base packs more value into each digit, so the result is shorter. The number 255 needs 3 digits in decimal and 2 in hexadecimal.

Decimal to Hexadecimal FAQ

How do I convert decimal to hexadecimal?

Divide the decimal number by 16, write down the remainder, and repeat with the quotient until it reaches 0. The remainders, read from last to first, are the base 16 number.

Which digits does decimal use?

Base 10 uses the digits 0 to 9. For example, A is not a valid digit in base 10.

Will the hexadecimal number be longer or shorter?

Shorter. Going to a larger base packs more value into each digit, so the result is shorter. Roughly 0.83 hexadecimal digits for every decimal digit. The number 255 needs 3 digits in decimal and 2 in hexadecimal.

What is 255 in hexadecimal?

255 in decimal is FF in hexadecimal. Both are the decimal number 255.

Can I convert negative numbers or fractions?

The converter handles whole numbers, and a leading minus sign works for negatives. Fractions use a different method, where you repeatedly multiply the fractional part by the new base, and they are not supported here.