Skip to content

Decimal to Hex Converter

Type a whole number to see it in hex, worked out by dividing by 16 and turning the remainders 10–15 into A–F.

Decimal uses only the digits 0–9

In hex (base 16)

FF

Decimal 255 is FF in hex (base 16).

16116
1601

15×16 + 15 = 255

Tap a digit to step it up. Each tile is worth its digit × 16n.

How to convert decimal to hex

Divide the number by 16 and keep the remainder, a value from 0 to 15. Write remainders of 10 to 15 as the letters A to F. Keep dividing the quotient by 16 until it reaches 0, then read the remainders from last to first.

For 48,879: 48,879 ÷ 16 = 3,054 r 15 (F), 3,054 ÷ 16 = 190 r 14 (E), 190 ÷ 16 = 11 r 14 (E), 11 ÷ 16 = 0 r 11 (B). Reading upward gives BEEF, a value programmers like to use as a recognisable marker.

Another route is through binary: write the number in binary, then group the bits in fours from the right. Each group of four is one hex digit.

n = 16 × q + r, with r from 0 to 15 written 0–9, A–F

Round decimal numbers in hex

Decimal values that come up in code, colours and memory sizes, with their hex form.

Decimal values that come up in code, colours and memory sizes, with their hex form.
DecimalHexWhere you see it
10A
15Flargest single hex digit
1610
3220ASCII space
6440
10064
1277Flargest signed byte
12880
200C8
255FFlargest byte, a full colour channel
Show all 20 rows
256100
1,0003E8
1,0244001 KiB
4,0961000a common memory page (4 KiB)
10,0002710
48,879BEEFthe BEEF marker
65,535FFFFlargest 16-bit value, highest TCP port
1,000,000F4240
16,777,215FFFFFFwhite, #FFFFFF
4,294,967,295FFFFFFFFlargest 32-bit value

Frequently Asked Questions

What is 255 in hex?

255 is FF: 255 ÷ 16 = 15 r 15, and 15 is F, so both digits are F. It is the largest number one byte can hold.

How do I convert a decimal colour like rgb(255, 128, 0) to hex?

Convert each channel to two hex digits and join them: 255 = FF, 128 = 80, 0 = 00, so the colour is #FF8000. The colour converter does all three at once.

Why does hex use letters?

Base 16 needs a single symbol for each value from 0 to 15, but there are only ten numerals. The letters A to F fill the gap for 10 to 15.