ToolLineup

Text to Hex Converter

This text to hex converter turns any text or string into hexadecimal and decodes hex back into text. Output comes spaced (48 65 6C), run together (48656c), as a 0x array, as \x escapes, URL %-encoded or colon-separated, in upper or lower case, and hex in any of those forms can be pasted back to decode. Text is encoded as UTF-8, so accents, Chinese and emoji convert correctly, and each character is listed with its hex bytes, code point and binary, alongside a classic hex dump.

How it works

Type or paste text to see its bytes in hexadecimal: each byte is two hex digits, so Hello becomes 48 65 6C 6C 6F. Text is encoded as UTF-8 first, so every alphabet works — é is two bytes (C3 A9) and an emoji is four.

Switch to Hex → Text to decode. Hex can be pasted in any common form: 48 65 6C, 48656c, 0x48, 0x65, \x48\x65, %48%65 or 48:65.

Try:
Text
Type or paste text…
Hex

How to convert text to hex by hand

Every character has a number. For English letters, digits and punctuation that number is its ASCII code, and the hex is that number written in base 16: divide by 16, and the quotient and remainder are the two hex digits (10 to 15 are written A to F). For Hello:

CharacterASCII code÷ 16Hex
H724 remainder 848
e1016 remainder 565
l1086 remainder 12 (C)6C
l1086 remainder 12 (C)6C
o1116 remainder 15 (F)6F

So Hello in hex is 48 65 6C 6C 6F, or 48656c6c6f without spaces.

ASCII to hex table

The printable ASCII characters. Read the first hex digit from the row and the second from the column: A is row 4, column 1, so 41. Capitals and lowercase letters are exactly 20 apart (A = 41, a = 61), and the digits 0–9 are 30–39.

First digit 0123456789ABCDEF
2_ SP!"#$%&'()*+,-./
3_ 0123456789:;<=>?
4_ @ABCDEFGHIJKLMNO
5_ PQRSTUVWXYZ[\]^_
6_ `abcdefghijklmno
7_ pqrstuvwxyz{|}~DEL

SP is the space (20). Below 20 are control characters: 09 is a tab, 0A a line feed and 0D a carriage return.

Accents, other alphabets and emoji

ASCII stops at 7F. Every other character is stored in UTF-8 as two to four bytes, which is why text with accents or emoji produces more hex than it has characters:

CharacterCode pointUTF-8 hexBytes
AU+0041411
éU+00E9C3 A92
€U+20ACE2 82 AC3
你U+4F60E4 BD A03
😀U+1F600F0 9F 98 804

If you need the Unicode number rather than the stored bytes, for example to write é in source code, choose Unicode code points in the converter.

How to convert hex to text

Split the hex into pairs, turn each pair into a byte, and read the bytes as UTF-8: 48 69 21 is Hi!. Hex with no spaces works the same way, two digits at a time. That is why the number of digits must be even; an odd count means one went missing when the hex was copied, and every byte after it would be read wrongly.

If the result shows � characters, those bytes are not valid UTF-8. The usual causes are bytes in the wrong order (for numbers stored little-endian, try the reverse hex tool), a sequence cut short, or text saved in an older encoding such as Latin-1.

Hex formats and where they are used

FormatExampleWhere you see it
Spaced48 65 6C 6C 6FHex dumps, debuggers, network captures
No spaces48656c6c6fHashes, keys, database columns, most programming output
0x array0x48, 0x65, 0x6CByte arrays in C, C++, Java and C#
\x escapes\x48\x65\x6CString literals in Python, C, JavaScript and shell printf
%-encoded%48%65%6CURLs and form data
Colon-separated48:65:6CMAC addresses and certificate fingerprints

The same conversion in code, for reference:

  • Python: 'Hello'.encode().hex() gives '48656c6c6f', and bytes.fromhex('48656c6c6f').decode() reverses it.
  • JavaScript: [...new TextEncoder().encode('Hello')].map(b => b.toString(16).padStart(2, '0')).join('').
  • Command line: printf 'Hello' | xxd -p prints 48656c6c6f.

Reading a hex dump

The dump below the converter shows the bytes the way most tools do: an offset, sixteen bytes in hex, and the same bytes as text. A few values are worth recognising on sight:

  • 20 — a space. Long runs of them mean padding.
  • 0A and 0D — line feed and carriage return. A 0D 0A pair means Windows line endings.
  • EF BB BF — a UTF-8 byte order mark at the start of a file.
  • C3 followed by something — the first byte of a two-byte UTF-8 sequence, so an accented letter.
  • 00 — a null. In a text file, usually a sign the data is UTF-16 or not text at all.

To write the bytes in binary instead, use text to binary; to convert a single number between hex, decimal and binary, use the number base converter.

Frequently asked questions

How do I convert text to hex?

Each character is stored as one or more bytes, and each byte is written as two hexadecimal digits. Type or paste your text and the hex appears as you type: Hello becomes 48 65 6C 6C 6F. Choose the output format — spaced, no spaces, 0x array, \x escapes, %-encoded or colon-separated — and upper or lower case.

How do I convert hex back to text?

Switch to Hex → Text and paste the hex. It can be in almost any form: 48 65 6C, 48656c, 0x48, 0x65, \x48\x65, %48%65 or 48:65 all decode, and the prefixes, quotes, brackets and separators are stripped for you.

How do you convert a letter to hex by hand?

Look up the character code and write it in base 16. H is 72 in ASCII; 72 ÷ 16 = 4 remainder 8, so H is 48 in hex. Lowercase letters are 20 higher than capitals: A is 41 and a is 61. The page has an ASCII hex table for the common characters.

Is text to hex the same as ASCII to hex?

For plain English letters, digits and punctuation, yes: ASCII and UTF-8 give the same single byte for each. They differ only beyond ASCII, where UTF-8 uses two to four bytes — é is C3 A9, € is E2 82 AC and 😀 is F0 9F 98 80. ASCII has no codes for those characters at all.

Why hexadecimal rather than decimal?

Every byte is exactly two hex characters, so a dump stays aligned and each character maps to exactly four bits. Decimal bytes vary between one and three digits and align badly.

What is the difference between UTF-8 bytes and code points?

A code point is a character’s number in Unicode, such as U+00E9 for é. UTF-8 bytes are how that number is stored: é becomes the two bytes C3 A9. Most systems want the bytes; choose code points when you need the U+ number, for example to write \u00E9 in code.

What does it mean when some characters show as �?

The bytes are not valid UTF-8 at that point, so the readable part is decoded and each broken sequence is marked with �. Usually the bytes are in the wrong order, some are missing, the text was saved in another encoding such as Latin-1, or the data was never text.

Why do I get an odd number of hex digits error?

Every byte is exactly two hex digits, so hex for whole bytes always has an even number of digits. An odd count means a digit was lost or added when copying, and decoding would shift every byte after it.

Is my data uploaded?

No. Everything runs in your browser.

Related tools