Hex Calculator - Hexadecimal Converter, Color Code Tool & Number System Calculator
Input
Enter the number you want to convert
Select the number system of your input
Quick Reference
Number Systems
- • Hexadecimal (Base 16): Uses digits 0-9, A-F
- • Decimal (Base 10): Uses digits 0-9
- • Binary (Base 2): Uses digits 0-1
- • Octal (Base 8): Uses digits 0-7
Bitwise Operations
- • AND: Both bits must be 1
- • OR: At least one bit must be 1
- • XOR: Bits must be different
- • NOT: Inverts all bits
Common Hex Values
- • FF: 255 (decimal)
- • 100: 256 (decimal)
- • FFFF: 65535 (decimal)
- • 1000: 4096 (decimal)
Color Codes
- • #FF0000: Red
- • #00FF00: Green
- • #0000FF: Blue
- • #FFFFFF: White
What is Hexadecimal?
Hexadecimal (hex) is a base-16 number system that uses 16 distinct symbols: digits 0-9 represent values zero to nine, and letters A-F represent values ten to fifteen. It's one of the most important number systems in computing and digital electronics.
The term "hexadecimal" comes from the Greek "hex" (six) and Latin "decima" (ten), referring to the system's base of 16. Each hexadecimal digit represents exactly four binary bits (a nibble), making conversion between hex and binary particularly straightforward.
Quick Reference:
- • Hex A = Decimal 10 = Binary 1010
- • Hex F = Decimal 15 = Binary 1111
- • Hex 10 = Decimal 16 = Binary 10000
- • Hex FF = Decimal 255 = Binary 11111111
How to Convert Hexadecimal Numbers
Hex to Decimal Conversion
To convert hexadecimal to decimal, multiply each digit by 16 raised to its position power (starting from 0 on the right) and sum the results.
Example: Convert 2A3F to decimal
2A3F₁₆ = (2 × 16³) + (10 × 16²) + (3 × 16¹) + (15 × 16⁰)
= (2 × 4096) + (10 × 256) + (3 × 16) + (15 × 1)
= 8192 + 2560 + 48 + 15
= 10,815₁₀
Decimal to Hex Conversion
To convert decimal to hexadecimal, repeatedly divide the number by 16 and record the remainders. Read the remainders in reverse order.
Example: Convert 254 to hexadecimal
254 ÷ 16 = 15 remainder 14 (E)
15 ÷ 16 = 0 remainder 15 (F)
Result: FE₁₆
Hex to Binary Conversion
Each hexadecimal digit converts to exactly 4 binary bits, making this conversion very straightforward.
| Hex | Binary | Hex | Binary |
|---|---|---|---|
| 0 | 0000 | 8 | 1000 |
| 1 | 0001 | 9 | 1001 |
| 2 | 0010 | A | 1010 |
| 3 | 0011 | B | 1011 |
| 4 | 0100 | C | 1100 |
| 5 | 0101 | D | 1101 |
| 6 | 0110 | E | 1110 |
| 7 | 0111 | F | 1111 |
Understanding Hex Color Codes
Hex color codes are six-digit hexadecimal numbers that represent colors in web design and digital graphics. The format is #RRGGBB, where:
- RR = Red component (00-FF / 0-255)
- GG = Green component (00-FF / 0-255)
- BB = Blue component (00-FF / 0-255)
Common Colors:
- #FF0000 - Red
- #00FF00 - Green
- #0000FF - Blue
- #FFFFFF - White
- #000000 - Black
Popular Web Colors:
- #3B82F6 - Blue
- #10B981 - Green
- #F59E0B - Orange
- #EF4444 - Red
- #8B5CF6 - Purple
Common Uses of Hexadecimal
🎨 Web Design & Graphics
- • Color specifications (#FF5733)
- • CSS styling
- • Image editing tools
- • Digital design software
💻 Programming
- • Memory addresses (0x00A1B2C3)
- • Character encoding (Unicode)
- • Bit manipulation
- • Error codes and debugging
🌐 Networking
- • MAC addresses
- • IPv6 addresses
- • Network configuration
- • Protocol analysis
🔐 Security
- • Cryptographic hashes
- • Encryption keys
- • Digital signatures
- • Security tokens
Tips & Best Practices
💡 Tip #1: The 0x Prefix
In programming, hex numbers often use the "0x" prefix (e.g., 0xFF) to distinguish them from decimal numbers. This prevents confusion in code.
💡 Tip #2: Color Shorthand
When all RGB pairs are identical, you can use 3-digit shorthand: #FFF = #FFFFFF (white), #F00 = #FF0000 (red).
💡 Tip #3: Memory Addresses
Hex is perfect for memory addresses because each pair of hex digits represents one byte (8 bits), making it easy to calculate memory sizes.
💡 Tip #4: Case Insensitive
Hexadecimal letters A-F can be written in uppercase or lowercase (e.g., #FF00AA = #ff00aa). Both are valid and equivalent.