EditSafely

UTF-8 Encode a String

Encode a string as its UTF-8 bytes in hexadecimal.

Runs on your device, nothing uploaded

Format
Separator
Hex case
Try:

0 chars · 0 lines

Output

Encode a string as its UTF-8 bytes in hexadecimal.

Type or paste above to see the result here.

Example: Encode

What you paste never leaves this tab

UTF-8 Encode a String is JavaScript that your browser has already downloaded, and it does the whole job on your own machine. On a normal site, the text you paste is sent to a server that can log it, cache it or keep it. Here it is read and transformed inside this tab and nowhere else.

  • No upload
  • No length limit
  • Works offline once loaded
  • Nothing stored or logged

How to use UTF-8 Encode a String

  1. 1. Paste the string. Enter any text into the input pane, including accented letters, symbols, or emoji. UTF-8 Encode a String converts each character into its raw bytes in hexadecimal.
  2. 2. Pick a Format and Separator. Choose a Format: plain hex bytes joined by the Separator (space, none, comma or your own), \x escapes for source code, %41 for URLs, or 0x41, for a C array. The result shows the character and byte counts, and Bytes per character lists each one.
  3. 3. Choose the Hex case. Set Hex case to lower or UPPER depending on the convention used by the system you are working with, since some hex dump tools expect one style consistently.
  4. 4. Copy the hex bytes. Copy the resulting sequence of hex bytes out of the output pane, ready to use in a binary protocol, hex editor, or documentation of the encoded string.

When to use UTF-8 Encode a String

UTF-8 Encode a String converts text into its raw UTF-8 bytes shown in hexadecimal, with a choice of separator and letter case. Use it whenever you need to see or produce the exact byte sequence a string encodes to.

  • Building a packet payload by hand. You are constructing a network packet manually and need the exact UTF-8 byte sequence for a text field to embed into the raw packet data.
  • Verifying a multi-byte character's byte count. You want to confirm how many bytes a specific character, such as an emoji or accented letter, takes up under UTF-8 before relying on that assumption in code.
  • Matching a hex dump tool's letter case. You are comparing encoded bytes against output from another tool that always uses uppercase hex, and setting Hex case to match avoids a false mismatch during comparison.
  • Documenting an API's exact wire format. You are writing protocol documentation and need to show the literal bytes a sample string produces on the wire, so readers can verify their own implementation against it.

Examples

Encode

Input

AÉ

Output

41 c3 89

One, two, three and four bytes

Input

AÉ€😀

Output

41 c3 89 e2 82 ac f0 9f 98 80

Escapes for source code

Input

é

Output

\xc3\xa9

About the UTF-8 Encode a String tool

UTF-8 Encode a String does its work locally, right in the browser. Encode a string as its UTF-8 bytes in hexadecimal. There is no upload step, no queue and no account, and your data never travels over the network.

It belongs to the String Tools collection on EditSafely, a set of 159 small, focused String utilities that share the same instant, private workspace.

You can shape the output with 3 settings, including Format, Separator and Hex case, and the result refreshes the moment you change one. 3 worked examples further down the page show exactly what the tool produces for real inputs.

Running locally also makes the tool fast and dependable: results appear as soon as your input does, there is no server outage that can take it down mid-task, and confidential data can be processed without a second thought.

Frequently asked questions

Is UTF-8 Encode a String free to use?

Yes, it is completely free. All 2,943 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

Everything happens locally. Your browser downloads the tool's code once, then does all the processing itself; nothing you enter is transmitted, stored or logged. You can even go offline after the page loads and it will still work.

How much text can I process at once?

There is no fixed limit; your device's memory is the ceiling. Up to 10 MB the result updates as you type, after a short pause that grows with the size. Above 10 MB a Run button appears so typing stays smooth, and files open up to 50 MB. A very long result shows its first 2,000 lines on screen, while Copy and Download always include all of it.

Do I need to sign up or install anything?

No. The tool works in any modern browser on desktop, tablet or phone. There is no account to create, no extension to add and no software to install.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.