Hex to Decimal کنورٹر
تیز اور درست نتائج کے لیے Hex to Decimal کنورٹر استعمال کریں۔
اس کیلکولیٹر کو کیسے استعمال کریں
- Hexadecimal درج کریں
- Decimal درج کریں
- حساب کریں بٹن پر کلک کریں
- کیلکولیٹر کے نیچے دکھائے گئے نتیجے کو پڑھیں
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:
| Position | 16³ | 16² | 16¹ | 16⁰ |
|---|---|---|---|---|
| Value | 4,096 | 256 | 16 | 1 |
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
- 1500 ÷ 16 = 93, remainder 12 → C
- 93 ÷ 16 = 5, remainder 13 → D
- 5 ÷ 16 = 0, remainder 5 → 5
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)
- 255 ÷ 16 = 15, remainder 15 → F
- 15 ÷ 16 = 0, remainder 15 → F
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 Color | R (decimal) | G (decimal) | B (decimal) | Color Description |
|---|---|---|---|---|
| #000000 | 0 | 0 | 0 | Black (all channels minimum) |
| #FFFFFF | 255 | 255 | 255 | White (all channels maximum) |
| #FF0000 | 255 | 0 | 0 | Pure red |
| #00FF00 | 0 | 255 | 0 | Pure green (lime) |
| #0000FF | 0 | 0 | 255 | Pure blue |
| #FF5733 | 255 | 87 | 51 | Vivid orange-red |
| #4A90D9 | 74 | 144 | 217 | Medium sky blue |
| #808080 | 128 | 128 | 128 | Middle 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:
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 4 | 0100 | 4 | 4 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 0001 0000 | 20 | 10 |
| 32 | 0010 0000 | 40 | 20 |
| 64 | 0100 0000 | 100 | 40 |
| 128 | 1000 0000 | 200 | 80 |
| 255 | 1111 1111 | 377 | FF |
| 256 | 0001 0000 0000 | 400 | 100 |
| 1,024 | 0100 0000 0000 | 2,000 | 400 |
| 65,535 | 1111 1111 1111 1111 | 177,777 | FFFF |
Shortcuts for fast conversion:
- Binary ↔ Hex: Group binary digits in sets of 4 (from right), convert each group to one hex digit. No division needed. 1010 1100 1111₂ = A, C, F = ACF₁₆
- Binary ↔ Octal: Group binary digits in sets of 3 (from right), convert each group. 001 010 011₂ = 1, 2, 3 = 123₈
- Hex ↔ Octal: Convert via binary as an intermediary — hex to binary (4 bits per hex digit), then binary to octal (3 bits per octal digit)
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:
- Units column: A(10) + F(15) = 25 decimal = 19₁₆ → write 9, carry 1
- Sixteens column: 3 + 2 + 1(carry) = 6
- Result: 69₁₆ = 105 decimal. Check: 58 + 47 = 105 ✓
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.
آخری اپ ڈیٹ: March 2026