Decimal to Hex Converter — Free Online Decimal to Hexadecimal Tool
Whether you’re working with CSS colors, assembly instructions, memory addresses, or network protocols, converting decimal numbers to hexadecimal is a daily task for developers. Our free Decimal to Hex Converter instantly translates any decimal integer into its hexadecimal, binary, and octal equivalents — no pen-and-paper math needed.
What Is Decimal to Hex Conversion?
Decimal is the number system humans use by default — base-10, digits 0 through 9. Hexadecimal (hex) is base-16, using digits 0–9 and letters A–F. Computers and digital systems favor hex because one hex digit maps exactly to 4 bits, making binary data far more compact and readable.
Converting from decimal to hex is fundamental in:
- Web design — Computing the hex code for any RGB color:
rgb(52, 152, 219)→#3498DB - Systems programming — Writing constants for memory addresses, bitmasks, and hardware registers
- Networking — Converting IP address octets and MAC address segments
- Assembly language — Working with x86/ARM instruction encodings and offsets
- Unicode — Understanding character codepoints: decimal 9786 →
U+263A(☺) - Cryptography — Key and hash values are typically expressed in hex
How to Use the Decimal to Hex Converter
- Enter a decimal number in the input field (any positive integer)
- The tool instantly shows:
- Hexadecimal — uppercase hex with
0xprefix - Binary — full binary representation
- Octal — base-8 representation
- Hexadecimal — uppercase hex with
- Copy any result to your clipboard
The conversion happens instantly as you type — no “Convert” button to click.
Decimal to Hex Conversion Table
| Decimal | Hexadecimal | Binary | Octal |
|---|---|---|---|
| 0 | 0x00 | 00000000 | 0 |
| 10 | 0x0A | 00001010 | 12 |
| 15 | 0x0F | 00001111 | 17 |
| 16 | 0x10 | 00010000 | 20 |
| 32 | 0x20 | 00100000 | 40 |
| 64 | 0x40 | 01000000 | 100 |
| 100 | 0x64 | 01100100 | 144 |
| 128 | 0x80 | 10000000 | 200 |
| 255 | 0xFF | 11111111 | 377 |
| 256 | 0x100 | 100000000 | 400 |
| 1000 | 0x3E8 | 1111101000 | 1750 |
| 65535 | 0xFFFF | 16 ones | 177777 |
Manual Conversion Method (Division by 16)
To convert decimal to hex manually, repeatedly divide by 16 and track remainders:
Example: Convert 255 to hex
| Division | Quotient | Remainder | Hex Digit |
|---|---|---|---|
| 255 ÷ 16 | 15 | 15 | F |
| 15 ÷ 16 | 0 | 15 | F |
Read remainders bottom to top: FF → 255 decimal = 0xFF hex ✓
Example: Convert 314 to hex
| Division | Quotient | Remainder | Hex Digit |
|---|---|---|---|
| 314 ÷ 16 | 19 | 10 | A |
| 19 ÷ 16 | 1 | 3 | 3 |
| 1 ÷ 16 | 0 | 1 | 1 |
Read bottom to top: 13A → 314 = 0x13A ✓
Decimal to Hex for CSS Colors
One of the most common practical uses: converting rgb() color values to hex codes.
For rgb(52, 152, 219):
- R: 52 →
34 - G: 152 →
98 - B: 219 →
DB - Combined:
#3498DB
For rgb(231, 76, 60):
- R: 231 →
E7 - G: 76 →
4C - B: 60 →
3C - Combined:
#E74C3C
Each channel is simply its decimal value expressed as a two-digit hex number (padded with a leading zero if < 16).
Common Use Cases
Bitmask constants — In C, writing 0xFF is equivalent to 255, but 0xFF immediately communicates “all 8 bits set” to someone reading the code. Bitmask values are virtually always written in hex in systems code.
Network byte manipulation — Converting IP address component values to their hex equivalents for protocol debugging.
Color space work — Working across CSS rgb() values, hex colors, and integer representations when building color pickers or image processing logic.
File format analysis — Identifying file types by their magic bytes (first bytes of the file). Knowing that 0xFF 0xD8 is JPEG and 0x89 0x50 is PNG requires decimal-to-hex fluency.
Unicode codepoints — Unicode character U+2764 (❤) is decimal 10084. Computing codepoints from decimal IDs when working with strings programmatically.
Frequently Asked Questions
What is the largest decimal I can convert?
JavaScript (which powers this tool) safely handles integers up to 2^53−1 = 9,007,199,254,740,991. For cryptographic keys or very large integers beyond this, precision may degrade. For such cases, use a BigInt-based tool.
Should hex letters be uppercase or lowercase?
Both are valid. 0xFF and 0xff represent the same value. CSS accepts both #FF0000 and #ff0000. Some conventions prefer uppercase (assembly, C constants), others lowercase (CSS standard, hash representations). Our tool outputs uppercase for maximum clarity.
How do I convert a negative decimal to hex?
This tool handles positive integers. For negative numbers, the two’s complement representation is used in most systems. For example, −1 as a signed 32-bit integer is 0xFFFFFFFF in two’s complement. Two’s complement conversion is system-context dependent (depends on bit width).
Can I convert floating-point decimal numbers to hex?
This tool converts integers. For floating-point (e.g., 3.14), the hex representation depends on the floating-point format (IEEE 754). This is a specialized operation most commonly done in low-level C or Rust programming.
Why do assembly programmers and game developers prefer hex?
In assembly, registers, opcodes, and memory addresses align naturally with 8-bit, 16-bit, and 32-bit boundaries. Hex values for these boundaries (0xFF, 0xFFFF, 0xFFFFFF, 0xFFFFFFFF) are immediately recognizable as “all bits set” patterns. Decimal equivalents (255, 65535, etc.) are less meaningful at a glance.