Decimal to hex conversion rewrites an everyday base-10 number as base-16, so 255 becomes FF and 4096 becomes 1000. You divide the number by 16 repeatedly and read the remainders, or you let a converter do it in one step. This guide shows how to convert decimal to hex and hex to decimal, the place-value math behind each, and a free tool for both directions.
In this guide
Why hexadecimal exists
Decimal uses ten digits, 0 to 9. Hexadecimal uses sixteen, adding A to F for the values ten through fifteen. Hex is popular in computing because it packs four bits into a single digit, so a byte that ranges from 0 to 255 in decimal fits neatly into two hex digits, 00 to FF. That tidy mapping to bits is why colors, memory addresses, and byte values are usually written in hex. Our number systems guide covers how all of these bases connect.
Convert decimal to hex
To convert decimal to hex, divide the number by 16 and note the remainder, then divide the result by 16 again, and keep going until the result is zero. The remainders, read from last to first, are the hex digits. Any remainder from 10 to 15 becomes A to F.
This is reliable but slow for large numbers, so the decimal to hex converter returns the answer instantly. Paste the decimal value and it gives you the hex form, ready to copy.
Convert hex to decimal
Hex to decimal works by place value. Each hex position is worth a power of 16: the rightmost is ones, the next is sixteens, the next is 256, and so on. You multiply each digit by its position value and add the results. The hex to decimal converter adds it all up for you, which is handy for long addresses where the place values grow fast.
A worked example
Convert 255 to hex. Divide 255 by 16 to get 15 with remainder 15, which is F. Divide 15 by 16 to get 0 with remainder 15, which is F again. Read the remainders bottom to top and you get FF. Check it the other way: F is 15, so the left F is 15 times 16 which is 240, plus the right F which is 15, giving 255. The round trip matches. If you want to see the same value as bits, the hex to binary converter expands FF to 11111111.
Where you meet these conversions
Decimal to hex turns up constantly in web and software work. CSS colors are hex, so the color value 255, 0, 0 becomes FF0000 red. Memory addresses in a debugger are hex, file offsets are hex, and many configuration values are stored in hex to stay compact. Being able to move a number between decimal and hex, or to read hex as text through our hex to ASCII guide, is part of everyday technical work.
Free converters used in this guide
Frequently asked questions
How do I convert decimal to hex?
Divide the number by 16 repeatedly and read the remainders from last to first, turning any remainder from 10 to 15 into A to F. A decimal to hex converter does this in one step.
What is 255 in hex?
255 in decimal is FF in hex, the largest value that fits in a single byte.
What is hex FF in decimal?
Hex FF is 15 times 16 plus 15, which is 255 in decimal.
Why are colors written in hex?
Because each color channel ranges from 0 to 255, which fits in exactly two hex digits, so a full red, green, and blue color packs into six hex characters such as FF0000.
Is decimal to hex reversible?
Yes. The value is the same in both bases, so converting hex back to decimal returns the original number exactly.