Text to Hex Converter

→
Text → UTF-8 bytes → 2 hexadecimal digits per byte, space-separated

Text to hex: the form bytes take in a trace

What this conversion does

It encodes text as UTF-8 and prints each byte as two hexadecimal digits. This is the notation in packet captures, memory viewers and protocol logs, so the conversion is really a translation between what a person types and what their tools display.

Two digits per byte, always

A byte holds values from 0 to 255, and two hexadecimal digits cover exactly that range — from 00 to FF. The pairing never varies, which is what makes a hex dump scannable: you can count bytes by counting pairs, and the offset column on the left tells you which pair you are looking at. A string of eight characters is eight pairs, and no character can produce half a pair.

Text to hex conversion table

Short strings with their hexadecimal byte values. Punctuation and digits become their ASCII values in a single pair, while anything outside the Latin alphabet expands to several pairs.

TextHexadecimal
A41
Hi48 69
OK4F 4B
12331 32 33
!21
Go47 6F

Finding a string inside a capture

Searching a packet capture for readable text rarely works, because what is on the wire is bytes and what you typed is characters. Converting the string you are looking for into hex gives you the exact sequence to search for, and it reveals why a search for a name with an accent in it fails when the same search without the accent succeeds: the encoded forms have different lengths, not merely different characters.

Mind the separators

This tool separates bytes with spaces for legibility, while many captures and URLs run the digits together or use percent signs. When searching, remove the spaces or convert them to the separator your tool expects — a sequence that looks identical at a glance can fail to match purely because of the gaps.

Frequently asked questions

How do I convert text to hex by hand?

Look up each character's UTF-8 byte value and write it as two hexadecimal digits. For "Hi" that is 48 and 69. For characters outside the ASCII range you need the byte values rather than the code point, since one character may occupy several bytes.

What is the difference between hex and binary output?

None beyond the notation. Both encode the same UTF-8 bytes; hexadecimal writes each byte as two digits and binary writes it as eight, so hex is four times shorter and much easier to scan. Choose hex for reading and binary when you need to see individual bits.

Why does my accented character become two bytes?

Because UTF-8 encodes anything above the original ASCII range in more than one byte, and most accented Latin letters take two. That is normal and not a corruption — the character is simply outside the range one byte can address, and any byte counter will see two.

Is this the same encoding as a URL uses?

Related but not identical. Percent-encoding writes UTF-8 bytes with a percent sign before each pair, so the byte values match this tool exactly and only the punctuation differs. Converting to hex here gives you the right bytes to percent-encode.

Can I use the output in a byte array literal?

Yes. The digits are exactly the byte values, so adding a 0x prefix to each pair gives a literal for most programming languages. The tool prints upper case by convention; lower case is equally valid wherever you paste it.

Copy the code below and paste it into your website to add this converter.

<!-- Text to Hex -->
<iframe src="https://unitflow.net/embed/text-to-hex" title="Text to Hex" width="100%" height="420" loading="lazy" style="border:0;max-width:100%;display:block"></iframe>
<p><a href="https://unitflow.net/text-to-hex" target="_blank" rel="noopener">Powered by UnitFlow</a></p>