Decimal to Hex
Turn any whole number into hexadecimal instantly and copy it with one click. Free and private — the conversion is done locally in your browser, nothing is uploaded.
Whole numbers only. A leading minus sign and commas, spaces or underscores as thousands separators are accepted.
How to use the Decimal to Hex converter
- Enter a whole number. Type or paste any decimal integer — thousands separators are fine and a minus sign makes it negative.
- Pick your format. Choose uppercase (FF) or lowercase (ff) letters, and tick the box if you want the programmer-style 0x prefix included.
- Copy the result. The hexadecimal value updates live as you type; one click copies it exactly as shown, and the binary and octal forms are right below.
About this tool
Hexadecimal is the compact way programmers write binary: each hex digit stands for exactly four bits, so 255 becomes FF and 65,536 becomes 0x10000. Converting decimal to hex means repeatedly dividing by 16 and reading the remainders — tedious by hand once numbers grow, but instant here. Use this decimal to hex converter for CSS and RGB color values, memory addresses and offsets, Unicode code points, assembly constants, permission masks or any debugging session where a register holds a value you know only in base 10. Big-integer arithmetic keeps even numbers with thousands of digits exact.
The page performs every calculation locally in your browser, so the numbers you type stay on your device. For the opposite direction there is a Hex to Decimal converter with a full digit breakdown, and the Number Base Converter covers every base from 2 to 36.
Frequently asked questions
Should I use uppercase or lowercase hex letters?
They mean exactly the same thing — 0xFF equals 0xff. Uppercase is traditional in documentation and assembly listings, while lowercase is common in CSS colors, URLs and most modern programming styles. The toggle lets you match whatever convention your project uses.
What does the 0x prefix mean?
It is the marker most programming languages (C, JavaScript, Python and many more) use to say "this number is hexadecimal", so 0x1A is 26, not 1A thousand-something. Tick the checkbox if you are pasting the value into source code; leave it off for plain hex.
How does decimal convert to hex mathematically?
Divide the number by 16 repeatedly and record each remainder (0–15, written as 0–9 and A–F). Reading the remainders from last to first gives the hex digits. For example 500 → 31 r 4 → 1 r 15 (F) → 0 r 1, producing 1F4.
Can I convert negative or very large numbers?
Yes. Negative integers get a minus sign in front of the hex digits (sign-magnitude, not two's complement), and the converter accepts up to 5,000 decimal digits with exact arbitrary-precision math — far beyond ordinary 64-bit calculators.