The division-by-16 remainders method
To convert decimal to hex, divide by 16, write down the remainder, and repeat with the quotient until the quotient is 0. Then read the remainders from the last one to the first — bottom to top. Remainders 10 through 15 become letters A through F. To convert hex to decimal, do the reverse: expand each digit times its power of 16 and add. F in the units place is worth 15, F in the sixteens place is worth 15 × 16 = 240, and so on.
The worked example, line by line
Setup: convert decimal 255 to hexadecimal.
Line 1 — divide. 255 ÷ 16 = 15 remainder 15 (F).
Line 2 — divide again. 15 ÷ 16 = 0 remainder 15 (F). The quotient is 0, so stop.
Line 3 — read bottom to top. The remainders, read last to first, are F then F: FF.
Line 4 — check by expanding. F × 16 + F = 15 × 16 + 15 = 240 + 15 = 255. The conversion checks out.
Branch A: 16 becomes 10
16 ÷ 16 = 1 remainder 0; 1 ÷ 16 = 0 remainder 1. Read bottom to top: 10. This is the cleanest illustration of the base: 10 in hex means one sixteen and zero ones, exactly as 10 in decimal means one ten and zero ones.
Branch B: 4095 becomes FFF
4095 ÷ 16 = 255 remainder 15 (F); 255 ÷ 16 = 15 remainder 15 (F); 15 ÷ 16 = 0 remainder 15 (F). Read bottom to top: FFF. Check: 15 × 256 + 15 × 16 + 15 = 3840 + 240 + 15 = 4095. Three F digits are the largest three-digit hex number, just as 999 is the largest three-digit decimal number.
Branch C: 0 becomes 0
Zero is zero in every base: decimal 0 converts to hex 0, with no division steps needed. Edge cases like this are where converters most often break, so it is worth stating: the answer is 0, not an empty string and not an error.
Branch D: going backwards — FF, ff, and 0xFF all become 255
Flip the direction and enter FF: F × 16 + F = 240 + 15 = 255. Enter lowercase ff and you get the same 255, because hex letters are case-insensitive. Enter 0xFF and you also get 255, because the 0x prefix is stripped before conversion — it is a label that says “this is hex,” not part of the number.
Output · formula · meaning
| Output | Formula | What it means |
| Hexadecimal digit | remainder of division by 16; 10–15 → A–F | Each step of the 255 example leaves remainder 15 (F), twice. |
| Full hex value | remainders read last to first | FF for 255 — reading top to bottom instead would still give FF here, but would be wrong in general. |
| Decimal check | Σ digit × 16position | 255 for FF: 15 × 16 + 15. Always expand to verify a conversion. |
Who uses this
- The programming student: converts 255 to FF by hand, then checks the converter, and finally understands why the color white is written #FFFFFF.
- The web developer: turns a decimal RGB value like 255 into the hex pair FF for a stylesheet, and flips back from FF to 255 when reading someone else's color code.
- The electronics hobbyist: reads a microcontroller register dump in hex, converts a value like FFF to 4095, and knows immediately it is the maximum of a 12-bit range.
- The exam candidate: practices the remainders method on 16 (10) and 4095 (FFF) until the bottom-to-top reading is automatic, rather than trusting a converter on test day.
Accuracy & limitations
Conversions are exact integer arithmetic within the stated range: decimal inputs from 0 to 999,999,999, whose largest hex form is 3B9AC9FF. The converter does not handle fractions, negative numbers, or values above that ceiling, and it does not guess at ambiguous input — a decimal point, a minus sign, a letter outside A–F, or an empty box is reported as an error with a reason, not silently rounded or truncated. Hex input is case-insensitive and an optional 0x prefix is accepted; anything else in the box is rejected. Error policy: negative decimal values, non-integer decimals, non-hex characters, empty input, and values above 999,999,999 are all reported as errors rather than modeled.
Cite this calculatorBright Side Kit. “Decimal to Hex Converter: Two-Way Tool — Bright Side Kit.”
brightoolbox.com, 2026.
Bright Side Kit. "Decimal to Hex Converter: Two-Way Tool." https://brightoolbox.com/decimal-to-hex/ Accessed October 24, 2026.Data sources- Conversion method: repeated division by 16, remainders read last to first, remainders 10–15 written as A–F; reverse by expanding digits times powers of 16.
- Range note: the largest accepted decimal value is 999,999,999, which converts to 3B9AC9FF.
Embed this calculatorPaste this into any web page to embed the live calculator. The “Bright Side Kit” link below it must stay intact.
Frequently asked questions
What is 255 in hex?
FF. 255 ÷ 16 = 15 remainder 15 (F), and 15 ÷ 16 = 0 remainder 15 (F); reading the remainders bottom to top gives FF. Check: 15 × 16 + 15 = 255.
How do you convert decimal to hex by hand?
Divide by 16 repeatedly and read the remainders backwards. Each remainder is one hex digit (10–15 become A–F); stop when the quotient reaches 0, then read the remainders from the last division to the first.
What is 16 in hex?
10. 16 ÷ 16 = 1 remainder 0, then 1 ÷ 16 = 0 remainder 1, so the digits read bottom to top are 1 and 0. Hex 10 means one sixteen, just as decimal 10 means one ten.
What is FF in decimal?
255. Expand it: F × 16 + F = 15 × 16 + 15 = 240 + 15 = 255. Lowercase ff and the prefixed form 0xFF convert to the same 255.
Is hex case-sensitive?
No. Uppercase FF and lowercase ff are the same number, and this converter accepts both, with or without a 0x prefix. The converter displays capitals by convention, but it reads either case.
Why is hex used in computing?
Because one hex digit is exactly four bits. A byte (eight bits) is exactly two hex digits, so values like FF (255) or 0xFF map cleanly onto memory, colors, and register values without the long strings of binary.
What is the largest number this converter handles?
999,999,999 in decimal, which is 3B9AC9FF in hex. Anything larger is reported as an error rather than truncated, so a too-large input can never silently give a wrong answer.