Skip to main content
Numverto logo NUMVERTO
Published: 5 min read By
decimal hexadecimal number systems conversion

Decimal to Hexadecimal Conversion — Step by Step Guide

Learn how to convert decimal numbers to hexadecimal using the division-remainder method. Includes worked examples, comparison table, and free converter tool.

Introduction

Hexadecimal (base 16) is one of the most widely used number systems in programming. Whether you are working with CSS colour codes, memory addresses, or debugging binary data, you need to convert decimal to hex frequently. This guide teaches the standard division-by-16 method with clear worked examples.

🔧 Try it now: Decimal to Hex Converter — instant conversion with step-by-step division shown.

The Division-Remainder Method

To convert any decimal number to hexadecimal:

  1. Divide the decimal number by 16
  2. Record the remainder (0–15, where 10=A, 11=B, 12=C, 13=D, 14=E, 15=F)
  3. Use the quotient as the new number
  4. Repeat until the quotient becomes 0
  5. Read remainders from bottom to top — that is your hex result

Hex Digit Reference

DecimalHexDecimalHex
0088
1199
2210A
3311B
4412C
5513D
6614E
7715F

Worked Examples

Example 1: Convert 255 to Hex

StepDivisionQuotientRemainderHex Digit
1255 ÷ 161515F
215 ÷ 16015F

Read bottom to top: FF

Verification: F×16 + F×1 = 15×16 + 15 = 240 + 15 = 255 ✓

Example 2: Convert 4096 to Hex

StepDivisionQuotientRemainderHex Digit
14096 ÷ 1625600
2256 ÷ 161600
316 ÷ 16100
41 ÷ 16011

Read bottom to top: 1000

This makes sense — 4096 = 16³, so it is exactly “1” followed by three zeros in hex.

Example 3: Convert 500 to Hex

StepDivisionQuotientRemainderHex Digit
1500 ÷ 163144
231 ÷ 16115F
31 ÷ 16011

Read bottom to top: 1F4

Comparison: Decimal, Binary, Octal, Hex

DecimalBinaryOctalHex
10101012A
16100002010
100110010014464
25511111111377FF
40961000000000000100001000

Notice how hex is much more compact than binary — every hex digit represents exactly 4 binary bits.

Why Hex is Used in Programming

  • CSS colors: #FF5733 = RGB(255, 87, 51)
  • Memory addresses: 0x7FFFFFFF is easier to read than the binary equivalent
  • Machine code: Assembly uses hex for opcode bytes
  • IPv6 addresses: Written in hex groups (e.g., 2001:0db8::)
  • Unicode: Code points like U+0041 = ‘A’

Common Mistakes

  1. Forgetting A–F mapping — Remainders 10–15 must be written as A–F, not as two decimal digits
  2. Reading remainders top-down — Always read from the last remainder to the first
  3. Wrong division — Divide by 16 (not 8 or 2) for hexadecimal
  4. Confusing hex 10 with decimal 10 — Hex 10 = decimal 16

Frequently Asked Questions

How do I convert decimal to hex quickly?

For numbers under 256, divide by 16 once: quotient is the first hex digit, remainder is the second. For example, 200 ÷ 16 = 12 remainder 8, so 200 = C8 hex.

What is the hex equivalent of decimal 256?

256 ÷ 16 = 16 R0, 16 ÷ 16 = 1 R0, 1 ÷ 16 = 0 R1 → 100 hex. This equals 16² which is exactly “1” followed by two zeros in hex.

Why do CSS colors use hex?

Each color channel (Red, Green, Blue) ranges 0–255, which maps perfectly to two hex digits (00–FF). This gives 6 hex characters for a full RGB color.

Can I convert hex fractions?

This guide covers whole numbers. Fractional hex conversion requires multiplying the decimal fraction by 16 repeatedly — a less common operation.

What is the 0x prefix?

0x is a programming convention indicating a hexadecimal literal. 0xFF means “FF in hex” = 255 decimal. Our converter accepts input with or without this prefix.

Advertisement

Share this article

Learn Faster with Numverto

Explore free number system converters, binary tools, EMI calculators, GST calculators, and educational guides.

About Numverto

Numverto logo

Numverto Editorial Team

Numverto publishes educational content about number systems, computer science concepts, binary arithmetic, financial calculations, EMI formulas, GST calculations, and practical learning resources for students and professionals.

About | Contact | Editorial Policy

Article Metadata

Tags: decimal, hexadecimal, number systems, conversion

Last Updated: June 2026

Related Calculators

Advertisement

Related Articles

Popular Tools

View all 13 free tools → · Read tutorials · Number system guide