Hex Calculator
Convert numbers between decimal, hexadecimal, binary, and octal number systems. Enter a value in any format and see instant conversions to all other formats.
Number System Guide
Common Number Systems
• Decimal (Base 10): Uses digits 0-9
• Hexadecimal (Base 16): Uses 0-9 and A-F
• Binary (Base 2): Uses only 0 and 1
• Octal (Base 8): Uses digits 0-7
Usage Examples
• Programming: Color codes (#FF0000)
• Computing: Memory addresses
• Networking: IP address calculations
• Digital Systems: Logic design
Understanding Number Systems
Hexadecimal System
Hexadecimal (base 16) uses 16 digits: 0-9 and A-F. It's widely used in computing because it provides a compact way to represent binary data, with each hex digit representing exactly 4 binary digits.
- • A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
- • Color Codes: #FF0000 represents pure red
- • Memory Addresses: 0x1000, 0xABCD
- • ASCII Codes: 0x41 = 'A', 0x61 = 'a'
Binary and Octal
Binary (base 2) uses only 0 and 1, representing the fundamental on/off states in digital systems. Octal (base 8) uses digits 0-7 and was historically used in computing systems.
- • Binary: Foundation of all digital systems
- • Octal: Each digit represents 3 binary digits
- • Conversion: Powers of 2, 8, and 16 are related
- • Applications: Logic design, file permissions
💡 Number System Tips
• Quick Conversion: Each hex digit = 4 binary digits (bits)
• Powers of 2: Easy to convert between binary, octal, and hex
• Programming: Use 0x for hex, 0b for binary, 0o for octal
• Color Codes: #RRGGBB format uses hex values 00-FF for each color
Frequently Asked Questions
What is hexadecimal and why is it used?
Hexadecimal is a base-16 number system using digits 0-9 and letters A-F. It's used in computing because it provides a compact, human-readable way to represent binary data. Each hex digit represents exactly 4 binary digits, making conversions straightforward.
How do I convert decimal to hexadecimal?
Divide the decimal number by 16 repeatedly, taking the remainders. The remainders (converted to hex digits where needed) read from bottom to top give the hex result. For example: 255 ÷ 16 = 15 remainder 15 (F), 15 ÷ 16 = 0 remainder 15 (F), so 255 = FF in hex.
What are common uses of hex numbers?
Hex is used for HTML/CSS color codes (#FF0000 for red), memory addresses in programming, ASCII character codes, file signatures (magic numbers), MAC addresses, and cryptographic hashes. It's essential in web development, programming, and system administration.
How do binary and hex relate to each other?
Each hexadecimal digit represents exactly 4 binary digits. For example, hex F = binary 1111, hex A = binary 1010. This makes hex-binary conversion simple: just convert each hex digit to its 4-bit binary equivalent, or group binary digits in fours to convert to hex.
What's the difference between 0xFF and FF?
Both represent the same value (255 in decimal), but 0xFF is the prefix notation commonly used in programming languages to explicitly indicate a hexadecimal number, while FF is just the hex digits. Similar prefixes include 0b for binary (0b11111111) and 0o for octal (0o377).