Done

๐ŸŸฃ Decimal โ†” Hex Converter

Convert decimal numbers to hexadecimal (baseโ€‘16) and back โ€” with step-by-step division, byte grouping, all-bases view, and RGB color preview.

Input
Hexadecimal Result
FF
255
Decimal
FF
Hex
2
Hex digits
1
Bytes
All bases
Decimal (Base 10)
255
Hex (Base 16)
FF
Binary (Base 2)
11111111
Octal (Base 8)
377
Quick Samples
Common CSS colors:
History
No conversions yet.
Hex Digit Reference
Dec Hex Bin
Tips
Divide by 16 repeatedly, map remainders to 0โ€“9 / Aโ€“F, read bottom-to-top.
CSS colors are 6-digit hex: #RRGGBB. Each pair is 0โ€“255.
0x prefix is used in programming (C, JS, Python) to mark hex literals.

About Hexadecimal Numbers

Why Base 16?

One hex digit represents exactly 4 binary bits (a nibble). Two hex digits represent a full byte (8 bits). This makes hex a compact, human-readable way to express binary data used in memory addresses, colour codes, and machine code.

Digits 0โ€“F

After 9, hex uses letters A=10, B=11, C=12, D=13, E=14, F=15. So FF = 15ร—16 + 15 = 255. This is why 0xFF is a common pattern in CSS, networking, and embedded programming.

CSS Colours

HTML/CSS colours are written as #RRGGBB where each pair is a hex byte 00โ€“FF. #FF0000 = Red (255,0,0), #00FF00 = Green, #0000FF = Blue. This tool previews 6-digit values as colours automatically.

0x in Code

In C, C++, Java, JavaScript, and Python, hex literals are written with a 0x prefix: 0xFF, 0x1A3B. This tells the compiler the literal is baseโ€‘16, not decimal. The toggle adds this prefix automatically.