Home Tools Blog About

Text to Hex: Convert Strings to Hexadecimal

Text to hex conversion turns each character of a string into its byte value written in hexadecimal, so “Hi” becomes 48 69. Every character has a numeric code, and hex is the compact, copy-safe way to write those codes as two digits per byte. This guide shows how to convert text to hex, what the bytes mean, and a free converter that handles any string in your browser.

What text to hex means

Every character a computer stores has a number behind it. The letter A is 65, a space is 32, and an exclamation mark is 33. Hexadecimal writes those numbers in base 16, where two hex digits cover one byte from 0 to 255. Text to hex simply walks through a string, takes each character code, and writes it as hex. Our number systems guide covers why hex pairs so neatly with bytes.

How the conversion works

Each character is looked up to get its code, and that code is written as two hex digits. The letter H is 72, which is 48 in hex. The letter i is 105, which is 69 in hex, so “Hi” is 48 69. A converter repeats this for the whole string, optionally adding spaces between bytes so the output is easy to read. The text to hex converter does it instantly, and the string to hex converter is the same job with extra control over spacing.

Convert a string by hand

Take the word “Go”. G is the 71st code, which is 47 in hex. The lowercase o is 111, which is 6F in hex. So “Go” is 47 6F. The method never changes: one character, one byte, two hex digits. To read hex back into text, the reverse is covered in our hex to ASCII guide.

Beyond ASCII: UTF-8 bytes

Plain English letters each fit in one byte, but accented and non-English characters do not. Under UTF-8, a character such as e with an accent or an emoji is stored as two, three, or four bytes, so its hex is longer than two digits. A good text to hex converter encodes the string as UTF-8 first, then writes every byte, so the output round-trips correctly even for international text.

When you need text in hex

Hex is the standard way to show raw bytes, so text to hex turns up whenever a string has to be inspected or transported at the byte level. Debugging a protocol, building a test vector, embedding a value in code, or comparing two strings byte for byte are all common reasons. Because the work runs entirely in your browser, you can convert private text without uploading it anywhere.

Free converters used in this guide

Frequently asked questions

How do I convert text to hex?

Take each character code and write it as two hex digits. The letter H is 72, which is 48 in hex, so “Hi” becomes 48 69. A text to hex converter does the whole string at once.

What is the letter A in hex?

Capital A has the code 65, which is 41 in hexadecimal.

Why is some text more than two hex digits per character?

Because non-English and accented characters are stored as multiple UTF-8 bytes, so each one produces several hex pairs instead of a single byte.

How do I turn hex back into text?

Read the hex in two-digit pairs and look up the character for each byte, which a hex to ASCII or hex to text converter does for you.

Is text to hex reversible?

Yes. As long as the same encoding is used, converting the hex back to text returns the original string exactly.

ATV

Written by Nick (ATV Team)

We build and maintain the 600+ free, client-side tools on this site, and every guide is written against the tools themselves: each figure is computed and checked before it is published, and every linked tool is tested in the browser. More about how we work on the about page, and the full library of guides lives on the blog.