Home  /  Developer Tools / Number Converters

Decimal to Hex Converter

Convert any whole decimal number to hexadecimal in seconds, with clear division steps and no sign up.

Last updated 13 November 2026

Decimal to Hex Converter Tool

Your result appears here.
Steps appear here after conversion.

Whole numbers only. Very large numbers are handled exactly with BigInt, so there is no rounding from floating point maths.

Decimal is the base 10 system we use every day. Hexadecimal is base 16, and it uses digits 0 to 9 plus letters A to F, where A is 10 and F is 15. Programmers use hex for colours, memory addresses, and byte values because one hex digit stands for exactly 4 bits.

How to Use This Tool

  1. Enter a decimal number: type a whole number, positive or negative.
  2. Click Convert: the hex result appears at once, with uppercase, lowercase, and 0x forms.
  3. Read the steps: the division steps show how the answer was reached.
  4. Copy the result: paste it into code, a colour value, or a document.

The Formula

Divide the decimal number by 16 again and again, and write down each remainder. Remainders 10 to 15 become A to F. Read the remainders from bottom to top. For example, 255 divided by 16 is 15 remainder 15, and 15 divided by 16 is 0 remainder 15, so 255 in hex is FF.

Worked Examples

DecimalHexUse
00Zero, the null byte
11One, a single hex digit
22Two, a single hex digit
33Three, a single hex digit
44Four, a single hex digit
55Five, a single hex digit
66Six, a single hex digit
77Seven, a single hex digit
88Eight, a single hex digit
99Nine, a single hex digit
10ATen, the first letter digit
11BEleven, a letter digit
12CTwelve, a letter digit
13DThirteen, a letter digit
14EFourteen, a letter digit
15FFifteen, the last letter digit
1610Sixteen, the first two digit hex value
10064A common test value
256100The count of values one byte can hold
10003E8A round decimal value
40961000Four kilobytes
65535FFFFThe largest value in two bytes
16777215FFFFFFThe largest 24 bit colour value

Why Use Hex

Hex is shorter than binary and easier to read than long decimal strings when you work with bytes. A single byte, 0 to 255, is always exactly two hex digits, from 00 to FF. That fixed width is why hex shows up in colour codes, where each colour channel is one byte, and in memory addresses, where a long binary address becomes a short hex string. When you debug code, hex lets you spot a wrong byte at a glance instead of counting 0s and 1s. Programmers also use hex in file formats, network packets, and character codes, because one hex digit maps to exactly four bits and never needs padding to line up.

What Is Hexadecimal?

Hexadecimal is a number system with base 16. It uses the digits 0 to 9 and the letters A to F, where A stands for 10, B for 11, C for 12, D for 13, E for 14, and F for 15. One hex digit holds exactly four bits, which is called a nibble, and two hex digits hold one byte. That neat fit is why programmers use hex everywhere they work with bytes. You see hex in colour codes like #FF5733, where FF is the red value, 57 is green, and 33 is blue. You also see it in memory addresses, in file hashes, in MAC addresses, and in error codes. When you debug code, hex makes long binary values short enough to read at a glance. A byte can hold any value from 00 to FF, which is 0 to 255 in decimal.

Decimal to Hex in Code

If you convert decimal to hex in code instead of a tool, here is how in four common places. The examples below all convert 255, and each one gives FF.

JavaScript: (255).toString(16) // ff Python: hex(255) // 0xff Excel: =DEC2HEX(255) // FF Java: Integer.toHexString(255) // ff

JavaScript and Python give lowercase hex, so convert the result to uppercase if you need FF instead of ff. Excel gives uppercase FF already. In Java, toHexString also gives lowercase, so call toUpperCase on the result if you need FF.

Hex is one of several number conversions on this site. To go the other way, use the Hex to Decimal Converter. To convert binary to hex, use the Binary to Hex Converter, and to convert binary to decimal, use the Binary to Decimal Converter. For octal, use the Octal to Decimal Converter, the Binary to Octal Converter, the Octal to Binary Converter, or the Octal to Hex Converter. To convert text, use the Text to Hex Converter or the Text to ASCII Converter.

Frequently Asked Questions

Yes. It is free, needs no sign up, and runs in your browser.

Yes. It uses BigInt, so very large whole numbers convert exactly, with no floating point rounding.

Yes. Enter a minus sign and the result keeps the minus sign in front of the hex digits. This tool does not use two's complement, so negative 1 shows as -1, not FF.

255 in hex is FF, because 15 times 16 plus 15 is 255, and 15 is F in hex.

No. It works in any modern browser on a phone, tablet, or computer.

0x is a prefix that marks a number as hexadecimal. It tells you the digits that follow are in base 16, not base 10. This tool shows the 0x form in its result, and you can write 0xFF in code to mean 255.

In Excel, use the DEC2HEX function. Type =DEC2HEX(255) in a cell, and Excel returns FF. DEC2HEX works with whole numbers only, just like this tool.

In Python, use hex(255), which returns 0xff. In JavaScript, use (255).toString(16), which returns ff. Both give lowercase hex, so convert the result to uppercase if you need FF.

Split the colour into red, green, and blue values from 0 to 255, convert each one to two hex digits, and join them after a hash sign. For example, red 255, green 87, and blue 51 becomes #FF5733. This tool converts one number at a time, so convert each of the three values in turn.

No. This tool works with whole numbers only. A value like 12.5 is not accepted, so convert the whole part only.