Text Encoding Converter

Choose a format and paste text or the encoded form. Hex, a hex dump, JavaScript and Python escapes, U+ code points, CSS and HTML escapes, and quoted-printable email text are covered.

Direction

Worked examples

Hex

Hi é

48 69 20 c3 a9

The é is two bytes in UTF-8.

Quoted-printable

Café costs £5 = fine

Caf=C3=A9 costs =C2=A35 =3D fine

Non-ASCII bytes and the equals sign are written as =XX.

Unicode escape

A é 😀

\u0041\u0020\u00E9\u0020\uD83D\uDE00

The emoji is a surrogate pair.

About Text Encoding Converter

Text is stored as bytes, and sometimes you need to see or write those bytes. Hex shows each UTF-8 byte as two digits and is how packet captures, hashes and file headers are read. A hex dump lays the bytes out in rows with an offset and a printable column, as debugging tools do. Escapes such as \u00E9 let source code and JSON hold any character using only plain ASCII.

Quoted-printable is the encoding email uses for text that is mostly ASCII. It writes other bytes as an equals sign and two hex digits and breaks long lines at 76 characters. This tool encodes and decodes all of these forms, handles characters outside the basic multilingual plane such as emoji, as surrogate pairs or full code points, and reports a malformed escape or an odd number of hex digits clearly. The quoted-printable output matches the standard library of a popular scripting language.

How to use Text Encoding Converter

  1. Choose a format from the list.
  2. Choose to encode or decode, and paste the text.
  3. Adjust the options, such as the separator between hex bytes or whether to change only non-ASCII characters.
  4. Copy the result.

Common uses

  • Reading the bytes of a string to find an encoding bug
  • Writing non-ASCII text into a source file as escapes
  • Decoding the text of a raw email
  • Producing a hex dump to paste into a bug report

Frequently asked questions

Which character encoding is used for hex?

UTF-8. An accented letter such as é is two bytes, c3 a9, and an emoji is four.

What is a surrogate pair?

Characters above U+FFFF are written in JavaScript and JSON as two \u escapes. The ES6 form \u{1F600} writes the code point in one go.

What are the 76 character lines in quoted-printable?

The standard limits each line to 76 characters. Longer lines are broken with a soft break, an equals sign at the end of the line, which is removed again when decoding.

Why is trailing space encoded?

Mail systems may strip spaces at the end of a line, so quoted-printable writes a final space or tab as =20 or =09 to keep it.

Can the hex dump be decoded?

No. It is for reading, with offsets and a printable column. Use plain hex bytes for a format that you can decode again.