Free Online Hex Converter
Convert text strings to hexadecimal (base-16) format and decode hex back to readable text instantly. Perfect for developers, debuggers, and low-level data tracking.
About Hexadecimal Encoding
Hexadecimal (hex) is a base-16 number system using digits 0-9 and letters A-F. It's widely used in computing because it provides a human-readable representation of binary data, with each hex digit representing exactly 4 bits.
Hexadecimal Chart
| Decimal | Hexadecimal | Binary | Decimal | Hexadecimal | Binary |
|---|---|---|---|---|---|
| 0 | 0 | 0000 | 8 | 8 | 1000 |
| 1 | 1 | 0001 | 9 | 9 | 1001 |
| 2 | 2 | 0010 | 10 | A | 1010 |
| 3 | 3 | 0011 | 11 | B | 1011 |
| 4 | 4 | 0100 | 12 | C | 1100 |
| 5 | 5 | 0101 | 13 | D | 1101 |
| 6 | 6 | 0110 | 14 | E | 1110 |
| 7 | 7 | 0111 | 15 | F | 1111 |
ASCII to Hex Examples
| Character | ASCII Decimal | Hexadecimal | Binary |
|---|---|---|---|
| A | 65 | 0x41 | 01000001 |
| a | 97 | 0x61 | 01100001 |
| 0 | 48 | 0x30 | 00110000 |
| Space | 32 | 0x20 | 00100000 |
| ! | 33 | 0x21 | 00100001 |
Common Use Cases
- ✓Memory Addresses: Display RAM addresses (0x7FFF0000)
- ✓Color Codes: Web colors (#FF5733 = RGB red, green, blue)
- ✓MAC Addresses: Network hardware (00:1A:2B:3C:4D:5E)
- ✓File Signatures: Magic numbers (PNG = 89 50 4E 47)
- ✓Debugging: View raw data in memory dumps
- ✓Cryptography: Display hash outputs and keys
- ✓Unicode: Character codes (U+1F600 = 😀)
Why Use Hexadecimal?
✓ Advantages
- • More compact than binary (4 bits = 1 hex digit)
- • Human-readable compared to raw binary
- • Easy conversion between hex and binary
- • Aligns with byte boundaries (2 hex = 1 byte)
- • Standard for memory addresses and dumps
- • Used in color codes, MAC addresses, etc.
Conversion Examples
Hex in Programming Languages
JavaScript/TypeScript
// Hex literal
const hex = 0xFF; // 255
// Convert to hex
const num = 255;
num.toString(16); // "ff"
// Parse hex string
parseInt("FF", 16); // 255Python
# Hex literal
hex_val = 0xFF # 255
# Convert to hex
hex(255) # '0xff'
# Parse hex string
int('FF', 16) # 255C/C++
// Hex literal
int hex = 0xFF; // 255
// Print as hex
printf("%X", 255); // FF
// Parse hex string
int val = strtol("FF", NULL, 16);Frequently Asked Questions
Why is hexadecimal used instead of decimal in programming?
Hexadecimal maps perfectly to binary logic systems. Each single hex digit represents exactly 4 bits (a nibble), making it far more compact and human-readable than raw binary bytes.
Are hex letters case-sensitive?
No, hexadecimal letters (A-F) are not case-sensitive. 0xFF, 0xff, and 0xFf all represent the same value (255). Most programming languages and tools accept both uppercase and lowercase.
What does the 0x prefix represent in a hex string?
The 0x prefix is a standard indicator used in programming languages (like C++, JavaScript, and Python) to specify that the following string value is a hexadecimal number, preventing it from being parsed as decimal.
How do I convert hex color codes?
Hex color codes like #FF5733 consist of three parts: Red (FF = 255), Green (57 = 87), and Blue (33 = 51). Each color channel uses 2 hex digits, representing values 0-255.
What's the maximum hex value?
For a single byte (8 bits), the maximum hex value is FF (decimal 255). For two bytes (16 bits), it's FFFF (decimal 65,535). For four bytes (32 bits), it'sFFFFFFFF (decimal 4,294,967,295).
Can hex represent negative numbers?
Hex itself doesn't have signs, but it can represent negative numbers using two's complement. For example, in an 8-bit signed system, 0xFF represents -1, 0xFE is -2, and 0x80 is -128. The interpretation depends on whether you're treating it as signed or unsigned.
Related Tools
You might also find these tools useful