Decimal to Hexadecimal Converter

Convert decimal to hexadecimal and hex to decimal. Step-by-step division method, CSS color preview, ASCII table, and common hex values reference.

Decimal
255
255
Hexadecimal
0xFF
1 byte(s)
Binary
1111 1111
8 bits
Octal
0o377
Base 8
CSS Hex Color
#0000FF
Enter 6 hex digits for color
Bytes
1
8 bits needed

Division Method (Decimal โ†’ Hex)

StepDividend รท 16QuotientRemainderHex Digit
1255 รท 161515F
215 รท 16015F

Read hex digits from bottom to top: 0xFF

Common Decimal-Hex Values

DecimalHexBinaryMeaning
00x000000 0000Null / zero
100x0A0000 1010Newline (LF)
130x0D0000 1101Carriage return (CR)
320x200010 0000Space character
650x410100 0001ASCII "A"
1270x7F0111 1111DEL / max 7-bit
2550xFF1111 1111Max unsigned byte
2560x1001 0000 0000First 2-byte value
1,0240x400100 0000 00001 KB (binary)
65,5350xFFFF1111 1111 1111 1111Max unsigned 16-bit
Planning notes, formulas, and examples

About the Decimal to Hexadecimal Converter

Hexadecimal (base 16) is the language of programmers and web designers. From memory addresses and color codes to MAC addresses and byte values, hex numbers appear everywhere in computing. It gives bidirectional conversion between familiar decimal (base 10) numbers and their hexadecimal equivalents, with all intermediate bases shown.

The step-by-step division method shows exactly how decimal-to-hex conversion works: repeatedly divide by 16 and read the remainders. For web developers, the built-in CSS color preview automatically interprets 6-digit hex values as RGB colors with a live swatch. The tool also includes a comprehensive common values reference and a scrollable ASCII table mapping characters to their hex codes.

Whether you are a web designer working with hex color codes, a programmer reading memory dumps, a student learning number systems, or troubleshooting network configurations, this converter gives you the conversion with educational context. The preset values cover the most commonly needed conversions including byte boundaries and popular color codes.

When This Page Helps

Manual hex conversion via the division method works but is tedious for large numbers. This converter shows the step-by-step work, previews colors for 6-digit hex values, and includes ASCII and common-value references โ€” a complete hex toolkit in one page for students, developers, designers, and technical support workflows.

How to Use the Inputs

  1. Choose the conversion direction: Decimal โ†’ Hexadecimal or Hexadecimal โ†’ Decimal.
  2. Enter your number in the input field (# prefix is automatically stripped for hex).
  3. View the result in all four bases: decimal, hex, binary, and octal.
  4. For values under 1,000,000, see the Division Method step-by-step.
  5. If the hex value is 6 digits, a CSS color preview appears automatically.
  6. Expand the ASCII Table reference for character-to-hex mapping.
Formula used
Decimal to Hex (division method): Repeatedly divide by 16, record remainders, read bottom-up. Hex to Decimal (positional): Sum of (digit_value ร— 16^position) for each digit. Example: 0xFF = 15ร—16ยน + 15ร—16โฐ = 240 + 15 = 255

Example Calculation

Result: 0xFF

255 รท 16 = 15 R 15. 15 รท 16 = 0 R 15. Remainders from bottom to top: 15, 15 = F, F. Result: 0xFF. This is the maximum value of an unsigned 8-bit byte (1111 1111 in binary).

Tips & Best Practices

  • Hex digits: 0-9 are the same as decimal, A=10, B=11, C=12, D=13, E=14, F=15.
  • CSS color codes: #RRGGBB where each pair is a hex byte (00-FF = 0-255).
  • Quick byte check: if hex has 1-2 digits, it fits in 1 byte. 3-4 digits = 2 bytes. 5-6 digits = 3 bytes.
  • ASCII printable characters span 0x20 (space) to 0x7E (tilde ~).
  • A hex color where all pairs match (#FF5733) has R=255, G=87, B=51 โ€” a vivid orange-red.
  • To convert hex to decimal quickly: each hex digit has a place value of 16^position, rightmost is 16^0.

Why Hexadecimal Dominates Computing

Hex is a perfect compromise between human readability and binary representation. Each hex digit maps to exactly 4 bits. Two hex digits represent one byte. This makes it compact yet easy to mentally convert to binary. A 32-bit memory address like 0x7FFF0000 is far more readable than 01111111111111110000000000000000 in binary or 2,147,418,112 in decimal.

Hex Color Codes for Web Design

CSS colors use the #RRGGBB format where each component is a hex byte (00-FF = 0-255). #000000 is black, #FFFFFF is white, #FF0000 is pure red. Shorthand #RGB expands each digit: #F00 = #FF0000. Newer CSS supports #RRGGBBAA with alpha transparency (00 = transparent, FF = opaque).

The ASCII Connection

ASCII maps characters to numbers 0-127. Printable characters span 0x20 (space) to 0x7E (tilde). Capital letters start at 0x41 (A), lowercase at 0x61 (a), digits at 0x30 (0). The uppercase-lowercase difference is exactly 0x20 (bit 5), which is why toggling case is a single bit operation.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • Divide the number by 16 repeatedly. Write down the remainder at each step. When the quotient reaches 0, read the remainders from last to first. Convert remainders 10-15 to A-F.