Decimal to Hex Converter

→
Hexadecimal = repeatedly divide by 16, keep each remainder as 0-9 or A-F

Decimal to hex: the shorthand programmers actually read

What this conversion does

It writes a base 10 number in base 16, using the sixteen digits 0 to 9 and A to F. Hexadecimal is not a different kind of number, only a shorter way of writing the same bits: one hexadecimal digit covers exactly four binary digits, so a 32-bit value takes eight characters instead of thirty-two. That compression is the whole reason the notation survives.

Why the letters A to F exist

Base 16 needs sixteen distinct digit symbols, and only ten are in common use, so the first six letters of the alphabet fill the gap: A is ten, B is eleven, and so on up to F for fifteen. The letters are digits, not shorthand, which is why FF means fifteen sixteens plus fifteen — 255 — rather than anything to do with the word "fifteen".

Decimal to hex conversion table

The decimal values that come up constantly in colour work, addressing and permission masks, with their hexadecimal forms. Values like 255 and 65535 mark the boundaries of one- and two-byte fields.

DecimalHexadecimal
00
11
77
88
10A
15F
1610
311F
6440
10064
1277F
200C8
255FF
10003E8

Colour codes and memory addresses

A web colour such as #1E90FF is three bytes — red, green and blue — written as six hexadecimal digits, and each pair is one channel from 0 to 255. The same notation appears in memory addresses, where 0x7FFE is far easier to compare at a glance than its decimal form. In both cases hex wins because its digits line up with byte boundaries: two digits, one byte, always.

Getting the case right

This converter prints upper case, matching the convention in C listings, datasheets and most documentation. Lowercase is equally valid and appears in URLs and some language literals, and the input field accepts either. Mixing the two within one value is legal but reads badly, so pick one and stay with it.

Frequently asked questions

How do I convert decimal to hex without a calculator?

Divide by 16, note the remainder as a hex digit, and repeat with the quotient until it reaches zero, then read the digits from last to first. For 255: 255 ÷ 16 is 15 remainder 15, and 15 ÷ 16 is 0 remainder 15, so the answer is FF. Remainders above nine are written as the letters A to F.

Why is hexadecimal used instead of binary?

Because four binary digits map onto exactly one hexadecimal digit, so the conversion is a straight substitution with no arithmetic. Hexadecimal is a compact, human-readable spelling of the same bits, which is why debuggers, disassemblers and network tools all reach for it.

What does the 0x prefix mean?

It is a marker used in C and many other languages to say "the digits that follow are hexadecimal", so 0x20 is thirty-two rather than twenty. This converter accepts a 0x prefix on input and needs no prefix on output, since the base is already clear from the page you are on.

How many hex digits does a 64-bit value need?

Sixteen, and this converter handles them exactly. A 64-bit number can exceed what floating-point arithmetic represents precisely, so a tool that used ordinary numbers would return a plausible-looking wrong answer for something like FFFFFFFFFFFFFFFF. Working in exact integers avoids that entirely.

Are the hex digits case sensitive?

No. FF and ff are the same value, and the input field accepts either. Output is upper case by convention, matching the style used in most source code, documentation and hardware manuals.

Copy the code below and paste it into your website to add this converter.

<!-- Decimal to Hex -->
<iframe src="https://unitflow.net/embed/decimal-to-hex" title="Decimal to Hex" width="100%" height="420" loading="lazy" style="border:0;max-width:100%;display:block"></iframe>
<p><a href="https://unitflow.net/decimal-to-hex" target="_blank" rel="noopener">Powered by UnitFlow</a></p>