Skip to content

Tool 39 / Format lines

See the numbers behind the text.

Turn letters, accents, and emoji into Unicode notation, or paste a code sequence and get readable text back. Six output formats, one local converter.

  • Free to use
  • Emoji-safe
  • Runs locally
Live workbench17 characters encoded

Code points are written in uppercase hex. JavaScript and UTF-16 formats use surrogate pairs for characters above U+FFFF.

Code sequence
18 characters in17 encodedunicode notationspace separatorUnicode-aware · never uploaded

What it does

This is a text-to-code-point converter. It reads the characters in your text and writes each one as a Unicode notation: a U+ number, an HTML entity, a JavaScript escape, or a UTF-16 code unit. The reverse direction accepts those notations and rebuilds the original text, including accents and emoji.

The name “ASCII to Unicode” is a common search phrase, but the useful distinction is between readable text and a representation that survives a context where the literal character does not. HTML entities belong in HTML, JavaScript escapes belong in source code, and U+ notation belongs in documentation and debugging. The converter picks the representation; it does not change the underlying text encoding of the page.

Notations

The same letter A can be written as U+0041, A, A, \u0041, 0x0041, or 65. These are different conventions for the same code point. An accented é is U+00E9. The emoji 🌍 is U+1F30D — one code point, but two UTF-16 code units and four UTF-8 bytes.

JavaScript and UTF-16 output use surrogate pairs for characters above U+FFFF. That is why a single emoji can produce two escapes. The decoder recognizes a high surrogate followed by a low surrogate and joins them. It refuses a lone surrogate rather than producing a broken character that looks fine in one editor and fails in another.

Skipping and line breaks

“Leave ASCII characters readable” keeps the first 128 code points as literal characters and only encodes the non-ASCII ones. It is the quickest way to document a few special characters in an otherwise plain sentence. The output is mixed by design: readable letters, escaped symbols. Turn it off when you need a uniform sequence that a parser can consume.

By default, line breaks are encoded too, because a line break is a character. “Keep line breaks as line breaks” preserves the visual structure of a multi-line input. That makes the result easier to read, but a strict decoder may treat the literal newline as a separator rather than data. Choose based on whether a human or a machine is the next reader.

Examples

Encode text as Unicode code points
Format: U+ · separator: space

Before

Hello 🌍
Café

After

U+0048 U+0065 U+006C U+006C U+006F U+0020 U+1F30D
U+0043 U+0061 U+0066 U+00E9

The space is U+0020 and the line break is not shown here because this example uses the newline-preserving option. The emoji stays one code point; the accented é is U+00E9. If you choose JavaScript output, the emoji becomes a surrogate pair instead.

Encode the same text as HTML entities
Format: HTML hex · ASCII left readable

Before

Hello 🌍
Café

After

Hello 🌍
Café

The ordinary letters remain readable and only the special characters become entities. In an HTML document, the browser resolves the entity back to the character. In a plain text file, it stays as literal notation. That difference is why the destination matters.

Decode a surrogate pair
JavaScript escapes → text

Before

\uD83C\uDF0D

After

🌍

Two UTF-16 code units become one astral character. The decoder also accepts \u{1F30D} and U+1F30D, which express the same character as a single code point.

Limits worth knowing

  • Code points are not grapheme clusters. A family emoji joined with zero-width joiners is several code points that render as one picture. Encoding it produces several numbers, not one. The tool preserves the sequence, but it does not collapse it into a single symbol.
  • HTML entities are context-sensitive. Encoding text as entities does not make it safe to inject into an HTML attribute, a script block, or a URL. Use the escaping rules for the exact context, not a general converter.
  • Malformed input is rejected. A lone surrogate, a value above U+10FFFF, or stray prose in the code box produces an error. The decoder does not skip unknown characters silently.
  • It is not encryption. Encoding is a public, reversible representation. Anyone can decode it. Use the Encryption Generator when confidentiality is the goal.
  • Very large inputs are still limited by the tab. Encoding creates several characters per input character, so a large document produces a much larger output. Work in excerpts if the page becomes sluggish.

Page updated

Questions, answered

Is this converting ASCII to UTF-8?

Not exactly. The page converts readable text to and from Unicode code-point notations such as U+0041, HTML entities, JavaScript escapes, and UTF-16 code units. It does not change the underlying UTF-8 bytes. For byte-level output, use the Binary Code Translator, which shows the UTF-8 byte sequence.

What is the difference between a code point and a UTF-16 code unit?

A code point is the Unicode number assigned to a character. UTF-16 represents code points above U+FFFF as a pair of 16-bit code units called surrogates. An emoji such as 🌍 is one code point but two UTF-16 code units. The JavaScript and UTF-16 formats show the pair; the Unicode format shows the single code point.

Why does HTML hex sometimes have no leading zeros?

HTML numeric character references do not require a fixed width. A and A both mean A. This tool writes the shortest hex form for HTML entities and pads Unicode, JavaScript, and UTF-16 hex output to four digits for readability.

Can I decode a mixture of formats at once?

Yes. The decoder accepts U+..., HTML decimal and hex entities, \uXXXX, \u{...}, \UXXXXXXXX, 0x... hex, and bare decimal values. Separators can be spaces, commas, semicolons, pipes, or line breaks. It also joins a high and low surrogate pair into one character.

What does “leave ASCII characters readable” do?

It keeps characters from U+0000 to U+007F as ordinary letters, digits, and punctuation instead of converting them. Only non-ASCII characters become codes. That produces a much shorter result when you are documenting a few special characters in an otherwise English string.

Is the text uploaded?

No. The conversion is local JavaScript. There is no server request, account, or stored copy, and the decoder does not fetch a Unicode table from a remote service.

All tools →