Toolvore

Unicode Escape/Unescape

Convert text to \u escape sequences and back.

This tool runs entirely in your browser. Your data is never uploaded, never stored, and never leaves your device.

Escaping rewrites characters outside plain ASCII as \uXXXX sequences — the JS string escape form — so text can sit in a source file, a .properties file or a protocol that only accepts ASCII, and this tool does it in both directions.

How to use it

  1. 1Choose Escape or Unescape; the page opens on Escape.
  2. 2Paste your text. In Escape mode, tick 'Escape everything' to escape the ordinary ASCII characters as well — that is also the only way to get newlines and tabs escaped.
  3. 3Copy the result from the Output box; if an escape cannot be read, an error appears above it and the output stays empty.

Example

Input
naïve “smart quotes” 🚀
Output
na\u00efve \u201csmart quotes\u201d \ud83d\ude80

By default only code points above 126 are escaped, which is usually what you want but is not enough to build a one-line string literal: a real newline or tab in your input passes straight through untouched. Tick 'Escape everything' and it all goes, control characters included — a line break becomes \u000a. Anything above U+FFFF is emitted as the two surrogate halves, \ud83d\ude80, never the braced \u{1f680}; that is the form Java, JSON and older JavaScript accept, and unescaping reads both forms and rejoins the pair. Going back the other way, only \u escapes are understood. \n, \t and \x41 are left as literal backslash sequences, so this is not a general string-literal unescaper, and a truncated escape such as caf\u00e stops the whole conversion with 'Malformed \u escape sequence' rather than quietly dropping the bad character.

What happens to your data

Escaping walks the string one code point at a time and reads each UTF-16 unit with charCodeAt; unescaping is a single regular expression feeding String.fromCodePoint. Neither path evaluates the text as code, so a fragment of script or a stray backslash inside it stays inert data. Nothing is transmitted at any stage, which is the point when the string you are escaping was lifted out of a config file that also holds a key.

Last updated August 2026

The build fails on a smart quotation mark someone pasted into a config file, or a colleague's accented name reaches a Java service as a row of question marks, with a ticket telling you to write it as \\u00e9 instead. Either way the job is to move text between two spellings: the characters a person reads, and an ASCII-only form a compiler, a properties file or an older protocol accepts.\n\nWork out first which of two problems you have, because they look alike and only one of them is about escaping. If the text is correct wherever you can see it and has to cross a channel that carries plain ASCII only, escaping is the answer. If the text is already wrong on screen, nothing here helps: that is an encoding mismatch, and escaping mangled characters preserves the mangling in a longer form.\n\nThen settle what the target actually requires. JSON, modern JavaScript, Python 3 and most current tooling read UTF-8 directly and need no escapes at all, so reaching for \\u there costs readability and buys nothing. Properties files loaded by older Java, some XML pipelines and a good many embedded formats do require it.\n\nThe common mistake is escaping the whole file when a handful of characters needed it, and an unreadable diff at review.

How it works

Toolvore walks your text one code point at a time and converts as you type — there is no convert button, and the output refreshes on every keystroke and every change of mode or setting. Escaping turns on a single numeric comparison: anything above code point 126 is rewritten, anything at or below it is copied through as it stands. That threshold is why a space survives while the delete character at 127 does not, and the digits come out as lowercase hex, four wide. Unescaping runs one regular expression over the text, and a doubled backslash in front of a sequence shields it from being read as an escape. The weak point is that failure is all or nothing: one sequence it cannot parse stops the whole conversion and leaves the output box empty rather than converting the good text and flagging the bad, so a single truncated escape hides an otherwise sound file.

Common use cases

  • Putting an accented name into a properties file that must stay ASCII
  • Chasing a smart quotation mark a build step keeps rejecting
  • Reading a log line full of \u sequences instead of words
  • Writing a test fixture around a known code point
  • Checking a copied string for a zero-width or non-breaking space
  • Pushing text through a channel that carries ASCII only

Frequently asked questions

What is a Unicode escape sequence?

Every character has a code point — a number set by the Unicode standard, so an e-acute is U+00E9 and the rocket is U+1F680. An escape sequence writes that number using characters that are safe everywhere: a backslash, a u, and four hexadecimal digits. Four digits is both the design and the limit, since the notation dates from when Unicode was thought to fit in 65,536 slots, so anything past U+FFFF has to be written as a pair. An escape is a spelling of a character, not a different character: once the source is parsed, the two are the same string.

Does JSON need Unicode escapes, or can I save the file as UTF-8?

JSON is defined over Unicode and UTF-8 is its default encoding, so an accented letter, a CJK character or an emoji can sit directly in a string and every current parser reads it. Escapes are permitted rather than required, and most writers emit them only where the grammar forces it: the double quotation mark, the backslash, and control characters below U+0020. What pushes people to escape anyway is usually a pipeline that mangles the file between writing and reading — a shell heredoc, a build step, a system that assumes Latin-1 — and an escaped payload survives all of them unchanged.

Why does one emoji turn into two escape sequences?

Because the four-digit form addresses a 16-bit unit rather than a character. Anything above U+FFFF — emoji, many historic scripts, the CJK extensions — is held in UTF-16 as a surrogate pair: two units in the D800 to DBFF and DC00 to DFFF ranges that mean nothing on their own. U+1F680 becomes \ud83d followed by \ude80, and the halves have to travel together. A system that truncates by counting units and cuts between them leaves a lone surrogate, which is why a replacement symbol turns up at the end of a trimmed message. Newer JavaScript accepts the braced form \u{1f680} as one escape instead.

How do I get an accented character into a Java properties file?

Before Java 9, a file loaded through Properties.load was read as ISO-8859-1, so anything outside that set had to be written as an escape, and the JDK shipped a native2ascii tool to convert files wholesale. From Java 9 onwards, resource bundles are read as UTF-8, falling back to ISO-8859-1 only when the bytes are not valid UTF-8, so plain accented text works. Escapes are still honoured either way, so they remain the safer choice when you do not control the runtime. The loader is what expands them: the file on disk holds a backslash, a u and four digits, not the character.

Why does my accented text show up as two odd Latin letters?

That is mojibake, and escaping it now freezes the damage. The two UTF-8 bytes of the accented letter have been read back as two separate Latin-1 characters, so escaping produces a faithful record of the wrong characters. The repair belongs where the misreading happened — a file opened without naming an encoding, a database column or connection on the wrong character set, an HTTP response missing charset=utf-8. Work backwards to the first place the text looks wrong and correct it there. Escaping is for text that is already right and has to cross something that cannot carry it.

Is it safe to paste a string out of a config file?

The conversion happens inside the page. Escaping reads your text with charCodeAt, unescaping is a single regular expression feeding String.fromCodePoint, and neither path evaluates what you paste as code, so a fragment of script stays inert data. No request carries the text anywhere. What you typed lives in an ordinary React state variable until you close or reload the tab — no history, nothing in local storage, nothing in the address bar. That matters here because the strings people escape are so often lifted out of a file with a credential two lines above.

What is the difference between the \u, \x, octal and ampersand-hash notations?

They are the same idea in different formats. The \u form with exactly four hex digits is what Java, JSON, C# and JavaScript use. The \x form takes two digits and stops at 255, covering Latin-1 and nothing beyond; C, Python and JavaScript accept it. Python adds an eight-digit variant for the whole range, plus a form that names a character outright. Octal is inherited from C and best avoided in new code. The ampersand-hash references are HTML and XML, closed by a semicolon rather than fixed in width, and belong in markup, not source.

Do I need to escape newlines, tabs and ordinary ASCII?

A line break inside a string literal is the usual reason people reach for escaping, and precision helps here. Most languages want the \n and \t shorthands — short, readable, understood everywhere — rather than the four-digit forms, which mean the same to a compiler but not always to a parser someone wrote by hand. Escaping ordinary printable ASCII is rarely necessary and makes the result hard to read. The exceptions are the characters a format reserves, such as a quotation mark inside a quoted string, and characters that are invisible.

Used in these workflows