Tools

Decimal to Hex Converter

Convert decimal numbers to hexadecimal, for colors and code

Decimal
–
Binary
–
Hexadecimal
–
Octal
–
–

How to convert decimal to hex

  1. Type a decimal number.
  2. Copy the hexadecimal result. Add 0x in front for most programming languages, or # for CSS colors.

The method

Divide by 16 repeatedly and write down the remainders, using A–F for 10–15, then read them from bottom to top. For 255: 255 ÷ 16 = 15 remainder 15 (F), 15 ÷ 16 = 0 remainder 15 (F), giving FF. For 4096: 4096 = 16³, so it is 1000 in hex.

DecimalHex
10A
15F
1610
3220
10064
12880
200C8
255FF
256100
10003E8
40961000
65535FFFF

Hex is the standard shorthand for bytes: each hex digit is 4 bits, so a byte is always two hex digits from 00 to FF. That is why web colors such as #FF8000 are written in hex: FF red, 80 green, 00 blue (255, 128, 0). Programmers use hex for memory addresses, error codes, Unicode code points and file signatures. The converter uses exact integers, so even 64-bit values are correct.

FAQ

What is 255 in hex?

FF.

How do I convert an RGB color to hex?

Convert each channel (0–255) to two hex digits and join them: rgb(255, 128, 0) is #FF8000. The color converter does this for you.

Is hex case-sensitive?

No. FF and ff are the same value; uppercase is common in documentation and lowercase in CSS and code.