Done

🟣 Decimal ↔ Hex Converter

Convert decimal to hexadecimal (base‑16), hex to decimal, binary, and octal — with step-by-step division, byte grouping, all-bases view, and RGB color preview. 100% free, no login.

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

Decimal to Hex Conversion Table — 0 to 255

This is the complete reference table for all decimal values 0 to 255 with their hexadecimal, binary, and octal equivalents. This range covers the full single-byte value space — the most commonly encountered range in color codes, ASCII, networking, and low-level programming.

Decimal Hex Binary Octal Decimal Hex Binary Octal

Use the converter above for values beyond 255 or for reverse conversion (hex → decimal).

How Hexadecimal (Base 16) Works — Complete Explanation

Hexadecimal is a positional numeral system with a base of 16. Like decimal (base 10) uses ten digits (0–9), hexadecimal uses sixteen symbols: the digits 0 through 9 and the letters A through F, where A represents 10, B represents 11, C represents 12, D represents 13, E represents 14, and F represents 15.

Positional Value in Hexadecimal

In any positional number system, each digit's value is the digit multiplied by the base raised to the power of its position (counting from 0 on the right). In hexadecimal, each position is a power of 16:

Position Power of 16 Value Example digit Contribution
Rightmost (0) 16⁰ 1 B (=11) 11 × 1 = 11
Second from right (1) 16¹ 16 A (=10) 10 × 16 = 160
Third from right (2) 16² 256 3 3 × 256 = 768
Fourth from right (3) 16³ 4096 1 1 × 4096 = 4096

So 13AB in hex = 4096 + 768 + 160 + 11 = 5035 in decimal .

Why Computers Use Hexadecimal

Computers operate in binary (base 2), using only 0s and 1s. Binary numbers become very long very quickly — the decimal number 255 requires 8 binary digits ( 11111111 ). Hexadecimal provides a compact shorthand: every 4 binary bits map to exactly one hex digit, and every 8 bits (1 byte) map to exactly two hex digits. This makes hex the natural language for expressing memory addresses, machine code, color values, cryptographic hashes, and network addresses.

The Relationship Between Hex and Binary

Hex digit Decimal value 4-bit binary
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111

How to Convert Decimal to Hex — Step-by-Step Method

The standard method for converting a decimal integer to hexadecimal is repeated division by 16 . Here are three worked examples at different scales.

Example 1: Convert 255 to Hex

  1. 255 ÷ 16 = 15, remainder 15 → F
  2. 15 ÷ 16 = 0, remainder 15 → F
  3. Reading remainders bottom-to-top: FF
  4. Result: 255 decimal = FF hexadecimal

Example 2: Convert 4096 to Hex

  1. 4096 ÷ 16 = 256, remainder 0 → 0
  2. 256 ÷ 16 = 16, remainder 0 → 0
  3. 16 ÷ 16 = 1, remainder 0 → 0
  4. 1 ÷ 16 = 0, remainder 1 → 1
  5. Reading bottom-to-top: 1000
  6. Result: 4096 decimal = 1000 hexadecimal

Example 3: Convert 16711680 to Hex (Red CSS color)

  1. 16711680 ÷ 16 = 1044480, remainder 0 → 0
  2. 1044480 ÷ 16 = 65280, remainder 0 → 0
  3. 65280 ÷ 16 = 4080, remainder 0 → 0
  4. 4080 ÷ 16 = 255, remainder 0 → 0
  5. 255 ÷ 16 = 15, remainder 15 → F
  6. 15 ÷ 16 = 0, remainder 15 → F
  7. Reading bottom-to-top: FF0000
  8. Result: 16711680 decimal = FF0000 hex (pure red in CSS)

Converting Hex Back to Decimal

Multiply each hex digit by 16 raised to the power of its position and sum the results:

Where Hexadecimal Is Used — Real-World Applications

Hexadecimal is used throughout computing, networking, graphics, and software development. Understanding hex is essential for any programmer, sysadmin, or digital designer.

🎨 CSS & HTML Colors

All CSS hex colors follow the #RRGGBB format. Each two-digit hex pair represents one color channel (0–255). Example: #1A2B3C = R:26, G:43, B:60. Shorthand #RGB is also valid.

💾 Memory Addresses

CPU memory addresses are expressed in hex in debuggers, disassemblers, and system logs. Example: 0x7FFE4A00 is a typical stack address. Hex is standard in GDB, LLDB, WinDbg, and all memory profilers.

🖥️ Programming Literals

Hex literals appear in code across all major languages. In C/C++/Java/JavaScript/Python: 0xFF , 0x1A3B . They're used for bitmasks, flags, hardware registers, and protocol constants.

🔐 Cryptographic Hashes

SHA-256, MD5, and all common hash algorithms output hex strings. A SHA-256 hash is 64 hex characters (256 bits = 32 bytes = 64 hex digits). Example: a665a45920422f9d417e4867efdc4fb8 .

🌐 IP & MAC Addresses

IPv6 addresses are written in hex groups: 2001:0db8:85a3:0000 . MAC (Ethernet) addresses are 6 bytes in hex: 00:1A:2B:3C:4D:5E . IPv4 is sometimes expressed as a single hex value.

📁 File Formats & Magic Bytes

Every binary file format begins with a "magic number" in hex. JPEG files start with FF D8 FF , PNG with 89 50 4E 47 , PDF with 25 50 44 46 . Hex editors use these to identify file types.

🔧 Assembly & Machine Code

CPU opcodes and machine code are written in hex. x86 assembly instruction encodings, ARM opcodes, and microcontroller register values are all expressed as hex bytes in datasheets and firmware.

🎮 Game Development

Game engines store color values, flags, item IDs, and save file data in hex. Cheat codes and memory editors work directly with hex addresses and values in game memory.

Comparing Number Systems — Decimal, Hex, Binary, Octal

Computers use multiple number systems for different purposes. Here is a comparison of the four most important bases used in computing.

Property Decimal (Base 10) Hexadecimal (Base 16) Binary (Base 2) Octal (Base 8)
Digits used 0–9 0–9, A–F 0, 1 0–7
Base 10 16 2 8
Bits per digit ~3.32 bits 4 bits (exact) 1 bit (exact) 3 bits (exact)
Digits to represent 255 3 (255) 2 (FF) 8 (11111111) 3 (377)
Prefix in code none 0x 0b 0 or 0o
Common uses Everyday numbers, human I/O Colors, addresses, hashes CPU logic, bitwise ops Unix permissions, legacy

Important Hex Boundary Values

Hex Value Decimal Significance
0x00 0 Null byte / minimum single byte value
0x0A 10 ASCII newline character (LF)
0x1F 31 Last ASCII control character
0x20 32 ASCII space character
0x41 65 ASCII uppercase 'A'
0x61 97 ASCII lowercase 'a'
0x7F 127 ASCII DEL character / max 7-bit value
0xFF 255 Maximum single-byte value
0x100 256 First value requiring 2 bytes (9 bits)
0xFFFF 65535 Maximum 16-bit unsigned integer
0xFFFFFF 16777215 Maximum 24-bit value / max RGB color
0xFFFFFFFF 4294967295 Maximum 32-bit unsigned integer

Frequently Asked Questions — Decimal to Hex Converter

Answers to the most common questions about hexadecimal numbers, conversion methods, and this tool.

Divide the decimal number by 16. Record the remainder and map it to its hex digit (0–9 stay as digits; 10=A, 11=B, 12=C, 13=D, 14=E, 15=F). Take the quotient and divide again by 16. Repeat until the quotient is 0. Read the hex digits you collected from bottom to top — that is your hexadecimal result. Example: 255 ÷ 16 = 15 R 15(F) → 15 ÷ 16 = 0 R 15(F) → reading bottom-to-top: FF.
255 in decimal is FF in hexadecimal. This is because 255 = (15 × 16) + 15, and 15 maps to F in hex. FF is the maximum value of a single byte (8 bits = 11111111 in binary). It appears as the maximum color channel value in CSS (#FFFFFF = white), as a bitmask 0xFF in programming, and as the broadcast byte in IPv4 (255.255.255.255).
The 0x prefix is a convention used in C, C++, Java, JavaScript, Python, and many other programming languages to indicate that the following number is in hexadecimal (base 16). For example, 0xFF is the hex literal for 255, and 0x1A3B is the hex literal for 6715. Without the prefix, the compiler would interpret the value as decimal. Python also accepts 0b for binary and 0o for octal.
CSS hex colors follow the format #RRGGBB where RR is the red channel, GG is green, and BB is blue — each a two-digit hex value from 00 (decimal 0) to FF (decimal 255). For example: #FF0000 is pure red (R=255, G=0, B=0), #00FF00 is pure green, #0000FF is pure blue, #FFFFFF is white, #000000 is black. A 4-digit #RGBA and 8-digit #RRGGBBAA format also exists with an alpha transparency channel. The 3-digit shorthand #RGB doubles each digit: #F00 = #FF0000 .
A nibble is exactly 4 binary bits. It can represent 16 distinct values (0 to 15), which maps perfectly to the 16 hexadecimal digits (0–F). This 1-to-1 relationship is why hex is so useful for expressing binary data: one hex digit = one nibble = 4 bits. Two hex digits = one byte = 8 bits. A 32-bit integer requires 8 hex digits; a 64-bit integer requires 16 hex digits.
Yes. Because one hex digit = exactly 4 binary bits, you can convert hex to binary directly by substituting each hex digit with its 4-bit binary equivalent without any arithmetic. For example: B = 1011, A = 1010, so BA hex = 10111010 binary. Similarly, to go from binary to hex, group the binary digits into 4-bit groups from right to left and convert each group to its hex digit.

Explore more free online tools from IndexCraft for number conversion and text processing.

🔢 Binary to Decimal
Convert binary numbers to decimal and other bases.
🔡 ASCII to Binary
Convert ASCII text characters to binary representation.
📝 Binary to Text
Convert binary code back to readable ASCII text.
🔡 Case Converter
Convert text between camelCase, snake_case, Title Case and more.
⚙️ JSON Formatter
Format, validate, and minify JSON data online.
🔗 URL Encode / Decode
Encode or decode URL strings and percent-encoding.