How to use
- Choose Encode to turn text into hex, or Decode to turn hex back into text.
- Type or paste the input, or open a file to see its bytes in hex.
- Set the options: Uppercase, a separator (none, space or colon) and a prefix (none, 0x or \x).
- Copy the result or download it as a file.
What is hexadecimal (Base16)?
Hexadecimal uses sixteen symbols, the digits 0 to 9 and the letters A to F. One hex digit holds four bits, so every byte is written as exactly two digits, from 00 to FF. The output is twice the size of the input, more than Base64 or Base32, but byte boundaries stay visible, which is why debuggers, hex editors and network tools display data this way.
RFC 4648 standardises the encoding as Base16, with an uppercase alphabet and no padding. In practice lowercase is just as common, and decoders, including this one, accept both.
Where hex is used
- Hashes and keys. A SHA-256 digest is 32 bytes, written as 64 hex digits. Cryptographic keys, UUIDs and checksums are usually shown in hex as well.
- Hardware addresses. MAC addresses are six bytes in hex, normally separated by colons. The colon separator produces that format.
- Escape sequences. C, Python and JavaScript strings accept
\xfollowed by two hex digits for a single byte, which is exactly what the\xprefix option writes. - Web formats. CSS colours such as
#FF8800are three bytes in hex, and URL percent-encoding writes bytes as%plus two hex digits.
Decoding hex to text
The decoder is forgiving about formatting. It accepts upper- and lowercase digits, ignores spaces, line breaks, commas, colons, semicolons and hyphens, and strips the prefixes 0x, \x, % and &#x. Output from xxd -p, MAC addresses, UUIDs, comma-separated 0x lists, %XX escapes and HTML hex entities can be pasted as they are. Each byte needs two digits, so an odd number of digits is reported as an error. The bytes are shown as text in the selected text encoding.
To change hex into another encoding without going through text, use Hex to Base64 or Base64 to Hex.
Hex in code
# Python
'Hi'.encode().hex() # '4869'
bytes.fromhex('4869').decode() # 'Hi'
// Node.js
Buffer.from('Hi').toString('hex') // '4869'
Buffer.from('4869', 'hex').toString('utf8') // 'Hi'
# Shell
printf 'Hi' | xxd -p # 4869
Specification
| Alphabet | 0-9 A-F |
|---|---|
| Output size | 2 characters per byte (200%) |
| Padding | None |
| Standard | RFC 4648 section 8 |
| Case sensitive | No |
Examples
| Input (UTF-8) | Output |
|---|---|
Hello, World! | 48656c6c6f2c20576f726c6421 |
Base64.is | 4261736536342e6973 |
你好 | e4bda0e5a5bd |
Frequently asked questions
How do I convert hex to text?
Switch to Decode and paste the hex. Spaces, colons and 0x or \x prefixes are removed automatically, and the bytes are shown as UTF-8 text unless you choose another text encoding.
Should hex be uppercase or lowercase?
Both represent the same bytes. RFC 4648 uses uppercase, while many programming languages print lowercase. Turn on Uppercase if your target system expects capital letters; the decoder accepts either.