Decimal to hexadecimal

Convert decimal to hexadecimal as you type, with any number of digits, the method step by step and a reference table.

loading Decimal to hexadecimal
About this tool

Decimal and hexadecimal

Decimal (base 10) is the everyday system: each digit is worth a power of 10. Hexadecimal (base 16) writes each group of 4 bits as one digit from 0 to F, so one byte is always two hex digits; it is the language of memory addresses, colors and hashes.

Needed to write a byte value, an offset, a Unicode code point (U+00E9) or a color channel in the form other tools expect.

This page opens the base converter with decimal as the input; it shows binary, octal, decimal, hexadecimal and Base64 at once, accepts prefixes such as 0x, 0b and 0o, and works with numbers of any length (no 2^53 limit). It runs in your browser.

Decimal vs hexadecimal

Decimalhexadecimal
Base1016
Digits0–90–9 A–F
Prefix in code—0x
255 is written255FF

How to convert decimal to hexadecimal by hand

Divide by 16 again and again and write down the remainders; read them from the last to the first. For 156:

DivisionQuotientRemainder
156 ÷ 169C
9 ÷ 1609

Read upwards: 156 = 9C in hexadecimal.

Decimal to hexadecimal table

Values computed by the converter itself:

DecimalHexadecimal
00
11
22
77
88
10A
15F
1610
3220
6440
10064
1277F
255FF
256100
10003E8
1024400
40961000
65535FFFF

Decimal to hexadecimal in code

JavaScript

(156).toString(16); // '9c'

Python

format(156, "X")  # '9C'

For integers beyond 2^53 in JavaScript, use BigInt: BigInt("0x…").toString(16).

Frequently asked questions

Does it handle very large numbers?

Yes. The converter uses arbitrary-precision integers (BigInt), so a 256-bit hash or a 100-digit number converts exactly; JavaScript Number would lose digits above 2^53.

Can I convert negative numbers or fractions?

Negative integers keep their sign (-255 → -FF); the tool does not write two’s complement or fractional digits. For a two’s complement byte, add 256 first (−1 → 255 → FF).

Why do programmers use hexadecimal instead of binary?

Because it is binary in short form: 4 bits per digit, 2 digits per byte, so 0xFF is easier to read than 11111111 and still maps bit for bit.

Report a problem