Convert decimal to hex – CSS colors and code values
255 = FF. 65535 = FFFF. Convert any decimal to hex — or hex back to decimal — instantly for web colors, debugging, and Unicode lookups.
When do you need to convert decimal to hexadecimal?
Hexadecimal (base-16) uses digits 0–9 and letters A–F. It is a compact way to represent binary data: each hex digit = 4 bits. This makes hex essential for programming, web colors, and memory addresses.
Web colors use hex: #FF5733 = red 255, green 87, blue 51. Memory addresses: 0x7FFF = 32,767. Unicode: U+00E9 = é.
Hex is more compact than binary: the byte 11111111 (8 digits) = FF (2 digits). This is why hex is preferred for displaying binary data.
All calculations run locally in your browser — nothing is sent to any server.
How does decimal to hex conversion work?
Repeatedly divide by 16 and record remainders (using A–F for 10–15). Read remainders bottom-to-top.
Example: 255 ÷ 16 = 15 R15 → F, 15 ÷ 16 = 0 R15 → F. Result: FF.
Each hex digit = 4 bits. Two hex digits = 1 byte (0–255). Four hex digits = 2 bytes (0–65,535).
Decimal vs Hexadecimal
| Feature | Decimal (base-10) | Hexadecimal (base-16) |
|---|---|---|
| Digits | 0–9 | 0–9, A–F |
| Example: 255 | 255 | FF |
| Example: 1000 | 1000 | 3E8 |
| Used for | Everyday math | Colors, addresses, data |
| Compactness | Standard | More compact than binary |
How to use the converter?
1. Enter a value
Type a number in the input field. You can use a period or comma as the decimal separator.2. Read the result
The conversion result appears instantly in the field next to it – no clicking required.3. Copy or reverse
Click Copy result or use the Reverse button to convert in the opposite direction.
When is this converter useful?
CSS and HTML Color Codes
Every CSS hex color is three hex pairs: #RRGGBB. #FF5733 = red 255, green 87, blue 51. Chrome DevTools shows colors in hex by default. Tailwind CSS v4 uses OKLCH, but legacy hex values remain common in codebases and design handoffs from Figma.JavaScript Hex Literals
JavaScript accepts hex literals with the 0x prefix: 0xFF === 255, 0x1A === 26. The Number.toString(16) method converts to hex; parseInt('FF', 16) converts back. Chrome DevTools memory panel shows all addresses in hexadecimal.Network Packet Inspection
Wireshark and tcpdump display packet contents as hex dumps. Each hex pair is one byte. MAC addresses use six hex pairs separated by colons: AA:BB:CC:DD:EE:FF. IPv6 addresses are eight groups of four hex digits.SHA and MD5 Hash Output
Cryptographic hashes are always displayed in hexadecimal. An MD5 hash is 32 hex characters (128 bits). SHA-256 produces 64 hex characters (256 bits). Each hex character represents 4 bits, so two characters represent one byte.
Practical tips
- Hex digits: 0123456789ABCDEF. A=10, B=11, C=12, D=13, E=14, F=15.
- 1 byte: 00–FF (0–255). 2 bytes: 0000–FFFF (0–65,535).
- Common prefixes: 0x (programming), # (CSS colors), U+ (Unicode).
- MAC address: 6 bytes in hex, e.g. AA:BB:CC:DD:EE:FF.
Convert Decimal to other units
Explore other unit converters
Frequently asked questions
What is 255 in hex?
255 = FF in hexadecimal. This is the maximum value of one byte (8 bits). It appears in CSS as #FFFFFF (white), in RGB as rgb(255, 255, 255), and as 0xFF in C, JavaScript, and Python source code.
What is 0xFF in decimal?
0xFF = 255 in decimal. The 0x prefix signals hexadecimal in most programming languages. In JavaScript: 0xFF === 255 evaluates to true. In Python: hex(255) returns '0xff'. In C: printf("%d", 0xFF) prints 255.
How do CSS hex colors work?
#RRGGBB format uses two hex digits per channel. Each pair ranges from 00 (0) to FF (255). #FF0000 = red 255, green 0, blue 0. #1A2B3C = red 26, green 43, blue 60. Shorthand: #RGB expands to #RRGGBB — #F0A = #FF00AA.
What does 0x mean in code?
0x is a prefix signaling hexadecimal in C, C++, Java, JavaScript, Python, Go, and Rust. Example: 0x1A = 26 decimal. Python also accepts 0o for octal and 0b for binary. In CSS, # serves the same purpose for color values.
How do I read a memory address in Chrome DevTools?
Chrome DevTools Memory panel shows addresses like 0x7FFF5FBF. Convert: 0x7FFF = 32,767 decimal. Each hex character is 4 bits, so a 6-digit hex address represents a 24-bit value (up to 16,777,215). 64-bit addresses are 16 hex digits long.
What is a Unicode code point in hex?
Unicode code points are written as U+ followed by hex digits. U+0041 = decimal 65 = letter 'A'. U+00E9 = decimal 233 = 'é'. U+1F600 = decimal 128,512 = the grinning face emoji. JavaScript accesses them via String.fromCodePoint(65) or '\u0041'.
Why are SHA/MD5 hashes displayed in hex?
Cryptographic hash functions output raw bytes. Hex is the standard way to display binary data in a readable, copy-pasteable format. An MD5 hash is 16 bytes = 32 hex characters. SHA-256 is 32 bytes = 64 hex characters. Each pair of hex digits represents exactly one byte.
Are calculations done locally?
Yes. All calculations run in your browser. No data is sent to any server.

Help us improve our tools
Have an idea, found a bug, or want to suggest a feature? Drop us a message – we respond within 24 hours.