What this calculator does
Hexadecimal, or hex, represents each byte of data as a two-digit base-16 number, using 0 to 9 and a to f. Text stored or transmitted as hex, such as "48 69" for the word "Hi", shows up in network dumps, colour codes, memory views, and plenty of programming and debugging contexts where raw bytes need a compact, readable format.
This converter works in both directions: paste in hex byte pairs to decode them back to readable text, or type in text to see its hex byte-pair representation. It covers the standard single-byte character range (0 to 255), the same scope as the ASCII and Latin-1 character sets, which covers plain English text and most common symbols.
The formula
To decode, the hex string is split into 2-digit pairs, each pair is read as a base-16 number, and that number is converted to its matching character. To encode, each character in the text is converted to its numeric character code and written back out as a 2-digit hex value.
| Term | Meaning |
|---|---|
| Hex (hexadecimal) | Base-16 number notation using the digits 0 to 9 and letters a to f, where each 2-digit hex pair represents one byte, a value from 0 to 255. |
| Byte pair | Two hex digits together, representing a single character's numeric code in hex form. |
| Character code | The underlying number a character is stored as, such as 72 for the capital letter H, which hex simply writes in base 16 rather than base 10. |
The inputs explained
| Field | What to enter |
|---|---|
| Convert | Whether to decode hex into text, or encode text into hex. |
| Hex (space-separated byte pairs) | The hex byte pairs to decode, space-separated (used only in hex-to-text mode). |
| Text | The text to encode into hex (used only in text-to-hex mode). |
When to use it
Reading a hex dump or network packet capture
Debugging tools frequently display raw data as hex; decoding a readable portion of it back to text confirms what the underlying bytes actually spell out.
Generating a hex-encoded value for code or configuration
Some file formats, protocols and configuration files expect a string written out as hex bytes rather than as plain text, which the text-to-hex direction produces directly.
Checking a value pulled from a database or log
Data that has been stored or exported as hex is quickly checked by decoding it back to the plain text it represents, without writing a script to do the conversion.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
What does a short word or phrase look like in hex?
A few short pieces of text, each converted to their hex byte-pair form.
| Text entered | Hex | Number of hex digits |
|---|---|---|
| Hi | 48 69 | 4 |
| Cat | 43 61 74 | 6 |
| Hello | 48 65 6c 6c 6f | 10 |
| 2026 | 32 30 32 36 | 8 |
| OK! | 4f 4b 21 | 6 |
Questions
Why does my hex input give an error?
The hex-to-text direction expects only the digits 0 to 9 and the letters a to f, in pairs, with any spaces ignored. A stray character outside that range, or an odd number of hex digits (which cannot form whole byte pairs), will trigger the error message rather than producing an incorrect result.
Does this handle spaces or punctuation in the text?
Yes, any character has a numeric code and therefore a hex value, including spaces, punctuation and digits, not just letters.
Can this decode text outside the basic English alphabet?
It covers single-byte character codes 0 to 255, the same range as ASCII and Latin-1, which includes plain English text and many accented Western European characters. Characters requiring more than one byte, such as most non-Latin scripts and emoji, are outside this single-byte scope.
How is hex different from binary for representing the same text?
Both represent the same underlying character codes; hex just does it more compactly, using 2 digits per byte instead of the 8 digits (bits) binary needs. See the binary to text converter for the same conversion using binary instead of hex.
For the same kind of conversion using binary instead of hex, see the binary to text converter. For a wider range of number base conversions, use the number base converter.