Skip to main content
🟢 Beginner

Hex to Decimal – Převodník

Použijte Hex to Decimal – Převodník pro rychlé a přesné výsledky.

Jak používat tuto kalkulačku

  1. Zadejte Hexadecimal
  2. Zadejte Decimal
  3. Klikněte na tlačítko Vypočítat
  4. Přečtěte si výsledek zobrazený pod kalkulačkou

Understanding the Hexadecimal Number System

Hexadecimal (hex) is a base-16 number system that uses 16 distinct symbols: the digits 0–9 and the letters A–F (where A=10, B=11, C=12, D=13, E=14, F=15). Hex is widely used in computing as a human-friendly way to represent binary data, because every 4 binary digits (bits) correspond to exactly one hex digit — making hex a compact shorthand for binary.

Each position in a hex number represents a power of 16:

Position16³16²16¹16⁰
Value4,096256161

Hex to decimal conversion: Multiply each hex digit by its place value (power of 16) and sum the results.

Example: 2F4A₁₆ = 2×4096 + F(15)×256 + 4×16 + A(10)×1 = 8,192 + 3,840 + 64 + 10 = 10,106

Hex numbers are typically prefixed with 0x in programming (e.g., 0x2F4A), or followed by h in assembly language (e.g., 2F4Ah), to distinguish them from decimal numbers.

Decimal to Hexadecimal Conversion

Converting from decimal to hexadecimal uses the same repeated-division method as binary conversion, but dividing by 16 instead of 2.

Method: Repeatedly divide by 16, recording the remainder at each step. Remainders 10–15 are written as A–F. Read remainders from bottom to top.

Example: Convert 1,500 to hex

Read bottom to top: 5DC₁₆

Verify: 5×256 + D(13)×16 + C(12)×1 = 1,280 + 208 + 12 = 1,500 ✓

Example: Convert 255 to hex (the maximum value of a byte)

Result: FF₁₆ — which is why 255 is represented as 0xFF in code and #FFFFFF (white) in CSS colors uses all three channels at max (255, 255, 255).

Quick mental conversion tip: For numbers under 256, split into the highest multiple of 16 (the first hex digit) and the remainder (second hex digit). 180 = 11×16 + 4 = B4₁₆. 200 = 12×16 + 8 = C8₁₆.

Hex Color Codes: Web and Design Applications

One of the most common everyday uses of hexadecimal is CSS and web color codes. Colors are specified as #RRGGBB, where RR, GG, and BB are two-digit hex values (00–FF) for red, green, and blue channels respectively.

Hex ColorR (decimal)G (decimal)B (decimal)Color Description
#000000000Black (all channels minimum)
#FFFFFF255255255White (all channels maximum)
#FF000025500Pure red
#00FF0002550Pure green (lime)
#0000FF00255Pure blue
#FF57332558751Vivid orange-red
#4A90D974144217Medium sky blue
#808080128128128Middle gray (50% of each)

Each channel (00–FF) provides 256 levels × 3 channels = 16,777,216 possible colors (16.7 million). The shorthand #RGB notation (e.g., #F5A) expands each digit to two identical digits: #FF55AA — used in CSS when both hex digits in a pair are identical.

Modern CSS also supports #RRGGBBAA (8 hex digits) for colors with transparency (alpha channel), where AA defines opacity from 00 (fully transparent) to FF (fully opaque). Example: #FF573380 = the orange-red at 50% opacity (80₁₆ = 128₁₀ ≈ 50%).

Hex in Programming and Computing

Hexadecimal appears throughout programming, hardware documentation, and computer science:

Memory addresses: RAM and processor addresses are expressed in hex. A 64-bit memory address might look like 0x7FFE0B4C3A20. Hex is used because it compactly represents the underlying binary, and 2 hex digits = exactly 1 byte — making address arithmetic intuitive.

Machine code and disassembly: CPU instructions are encoded as hex bytes. The x86 instruction MOV EAX, 0x42 compiles to hex bytes B8 42 00 00 00. Security researchers and low-level programmers read hex dumps to understand or reverse-engineer software.

ASCII character encoding: ASCII maps characters to numbers 0–127. In hex: 'A' = 0x41, 'a' = 0x61, space = 0x20, '0' = 0x30. The pattern is consistent — uppercase letters start at 0x41, lowercase at 0x61 (exactly 0x20 = 32 difference, which is why XOR-ing a letter with 0x20 toggles its case).

IPv6 addresses: 128-bit IPv6 addresses are written as 8 groups of 4 hex digits: 2001:0DB8:AC10:FE01:0000:0000:0000:0001. Each group represents 16 bits (4 hex digits × 4 bits each). IPv4 addresses can also be expressed in hex: 192.168.1.1 = 0xC0A80101.

Error codes: Windows stop codes ("Blue Screen of Death") are hex: 0x0000007E, 0xC0000005. UNIX errno codes, HTTP status codes in network packets, and BIOS POST codes all use hex. Recognizing common hex patterns helps troubleshoot system issues.

Binary, Octal, Decimal, Hex: The Complete Conversion Reference

The four number systems used in computing and how they relate:

DecimalBinaryOctalHex
0000000
1000111
2001022
4010044
81000108
10101012A
15111117F
160001 00002010
320010 00004020
640100 000010040
1281000 000020080
2551111 1111377FF
2560001 0000 0000400100
1,0240100 0000 00002,000400
65,5351111 1111 1111 1111177,777FFFF

Shortcuts for fast conversion:

Practical Hex Calculations and Tips

A few useful techniques for working with hex in practice:

Hex addition: Add column by column, carrying when the sum reaches 16. Example: 3A + 2F:

Checking divisibility in hex: A hex number is divisible by 16 if the last digit is 0 (same as divisibility by 10 in decimal). It's divisible by 2 if the last hex digit is even (0,2,4,6,8,A,C,E).

Hex in URLs and encoding: URLs encode special characters using percent-encoding: a space becomes %20 (0x20 = 32 = space in ASCII). The @ symbol = %40 (0x40 = 64 = '@' in ASCII). Knowing ASCII hex codes helps decode encoded URLs.

Hash functions output hex: MD5 produces 128-bit (32 hex chars) output. SHA-256 produces 256-bit (64 hex chars) output. Example SHA-256 hash: a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3 — always 64 hex characters regardless of input size. This is what you see when verifying file downloads against checksums.

Frequently Asked Questions

How do you convert hexadecimal to decimal?

Multiply each hex digit by 16 raised to its position power (starting from 0 on the right) and sum the results. Example: 1A3₁₆ = 1×256 + A(10)×16 + 3×1 = 256 + 160 + 3 = 419. Our calculator does this instantly for any hex value you enter.

How do you convert decimal to hexadecimal?

Repeatedly divide by 16 and record the remainder at each step. Remainders 10–15 are represented as A–F. Read remainders from last to first. Example: 255 ÷ 16 = 15 remainder 15(F); 15 ÷ 16 = 0 remainder 15(F) → 255 decimal = FF hex.

What are hexadecimal numbers used for?

Hex is used throughout computing: memory addresses (0x7FF0E2A0), web color codes (#FF5733), machine code and binary data, IPv6 network addresses, cryptographic hash outputs (MD5, SHA-256), ASCII character encoding, Unix file permissions, BIOS error codes, and any context where compact binary representation is needed.

Why does hex use letters A through F?

Hexadecimal is base-16, requiring 16 distinct symbols. The digits 0–9 cover the first 10 values. Letters A through F represent values 10–15 respectively. This convention was standardized in computing in the 1960s. The choice of uppercase vs lowercase (A-F vs a-f) varies by system; both are valid and represent the same values.

What is 0xFF in decimal?

0xFF = F×16 + F×1 = 15×16 + 15 = 240 + 15 = 255. This is the maximum value of an 8-bit byte (unsigned). It appears frequently in programming for bitmasks, maximum color channel values (RGB uses 0x00–0xFF per channel), and anywhere an 8-bit max value is needed.

How do I read hex color codes?

A hex color code like #4A90D9 is split into three pairs: 4A (red), 90 (green), D9 (blue). Convert each to decimal: 4A = 4×16+10 = 74; 90 = 9×16+0 = 144; D9 = 13×16+9 = 217. So #4A90D9 = rgb(74, 144, 217) — a medium sky blue. The higher the value (closer to FF/255), the more of that color component.

What is the difference between 0x prefix and # prefix in hex?

Both indicate hexadecimal numbers, but in different contexts. 0x (e.g., 0xFF, 0x1A3) is the standard prefix in programming languages (C, C++, Java, Python, JavaScript, etc.). # is used specifically for web/CSS colors (#FF5733). Some contexts use h suffix (assembly language), $ prefix (older systems), or no prefix (when context makes it clear).

How do you quickly convert between binary and hex?

Group the binary number into sets of 4 bits from right to left, then convert each group to a single hex digit. Since 4 bits = exactly one hex digit, no arithmetic is needed. Example: binary 1011 0100 1100₂ → group as 1011|0100|1100 → B|4|C → B4C₁₆. This works in reverse too: each hex digit expands to exactly 4 binary digits.

Naposledy aktualizováno: March 2026