Unicode Escape Converter
Encode text as Unicode escapes or decode escape sequences
Unicode Escape Converter — what it does
Encode text as Unicode escape sequences or decode escapes back into characters, with an option to escape only non-ASCII characters. Escapes are how non-ASCII text survives a source file, a configuration entry or a protocol that only reliably carries plain ASCII.
Worked example
A price note mixing an accented Latin letter, an en dash, a euro sign, Chinese and an emoji, encoded with "Escape only non-ASCII characters" ticked.
Input — text
Café – 15 € · 東京 😀
Output — escaped
Caf\u00e9 \u2013 15 \u20ac \u00b7 \u6771\u4eac \ud83d\ude00
ASCII letters, digits and spaces are left alone; the emoji takes two escapes (\ud83d\ude00) because it is written as a surrogate pair.
When this tool helps
- Embedding non-ASCII text safely in a source file whose encoding you do not control.
- Decoding escape sequences found in a JSON payload, log or properties file.
- Making invisible or ambiguous characters visible by escaping them.
How to use it
- Paste the text or the escaped string.
- Choose whether to escape only non-ASCII characters.
- Encode or decode.
- Copy the output.
Accuracy, limits, and good practice
- Escaping only non-ASCII keeps the text readable while making the parts that could break an encoding explicit — usually the right balance.
- Characters beyond the basic multilingual plane, including most emoji, are represented as surrogate pairs and take two escapes each.
- Escapes are also a debugging tool: they reveal a non-breaking space or a zero-width character that looks like nothing on screen.
- Escape before pasting text into a system whose encoding you cannot verify — an escaped string is plain ASCII and survives any pipeline.
Frequently asked questions
What does an escape sequence look like?
A backslash-u prefix followed by four hexadecimal digits, which is the form JSON, Java and JavaScript all use.
Do I still need escapes with UTF-8?
Rarely for modern systems, but they remain useful for legacy pipelines and for making invisible characters visible.
Why does one emoji produce two escapes?
It lies outside the basic multilingual plane and is encoded as a surrogate pair, which requires two escape sequences.
Are escapes case-sensitive?
The hexadecimal digits are conventionally lowercase but read either way; the backslash-u prefix itself must be lowercase.
What changes if I untick the non-ASCII option?
Every character is escaped, including letters, spaces and line breaks, and the result collapses to a single line: "A b" followed by a line break and "c" becomes \u0041\u0020\u0062\u000a\u0063. Hex digits are always lowercase and padded to four places.
Which escape forms does Decode understand?
Three: \uXXXX with exactly four hex digits, \u{…} with any number of digits (the form JavaScript uses for code points above FFFF), and \xXX with two digits. Decoding "\u{1F600} \u00e9 \x41" gives 😀 é A. Encode never produces the \u{…} or \x forms itself, and text without backslash escapes passes through Decode unchanged.
Related tools on this site
- Regex Tester — Test regular expressions and inspect every match
- XML to JSON — Convert XML elements and attributes into JSON
- Find & Replace — Replace repeated words or phrases at once
Further reading: Cleaning Up Text You Pasted From Somewhere Else
Everything above runs inside this page. Unicode Escape Converter needs no account, no upload, and no server round trip — close the tab and nothing is left behind.
Unicode 跳脫字元轉換能做什麼
把文字編碼成 Unicode 跳脫序列,或把跳脫序列解碼回字元,並可選擇只跳脫非 ASCII 字元。跳脫序列讓非 ASCII 文字得以安全通過原始碼、設定項或只能穩定承載純 ASCII 的協定。
實際範例
一則混合重音拉丁字母、連接號、歐元符號、中文與表情符號的價格備註,在勾選「只跳脫非 ASCII 字元」的狀態下編碼。
來源:文字
Café – 15 € · 東京 😀
跳脫後
Caf\u00e9 \u2013 15 \u20ac \u00b7 \u6771\u4eac \ud83d\ude00
ASCII 字母、數字與空格原樣保留;表情符號因以代理對表示而佔兩個跳脫序列(\ud83d\ude00)。
什麼時候用得上
- 把非 ASCII 文字安全嵌入你無法控制編碼的原始檔。
- 解碼 JSON 載荷、日誌或屬性檔中出現的跳脫序列。
- 把不可見或易混淆的字元跳脫出來,讓它現形。
使用步驟
- 貼上文字或跳脫字串。
- 選擇是否只跳脫非 ASCII 字元。
- 執行編碼或解碼。
- 複製輸出。
精確度、限制與實務建議
- 只跳脫非 ASCII 能保持文字可讀,同時把可能弄壞編碼的部分明確標出來——通常是最好的平衡。
- 基本多文種平面之外的字元(含多數表情符號)以代理對表示,每個要用兩組跳脫序列。
- 跳脫也是除錯工具:它能讓不換行空格或零寬字元這種螢幕上看不見的東西現形。
- 把文字貼進無法確認編碼的系統前先跳脫——跳脫後的字串是純 ASCII,任何流程都通得過。
常見問題
跳脫序列長什麼樣?
反斜線加 u,後面接四位十六進位數字,JSON、Java 與 JavaScript 都用這種形式。
用了 UTF-8 還需要跳脫嗎?
現代系統很少需要,但在舊系統流程中仍然有用,也方便讓不可見字元現形。
為什麼一個表情符號變成兩組跳脫?
它位於基本多文種平面之外,以代理對編碼,因此需要兩組跳脫序列。
跳脫序列區分大小寫嗎?
十六進位數字習慣用小寫,但兩種都讀得懂;反斜線後的 u 本身則必須小寫。
取消勾選「只跳脫非 ASCII」會有什麼不同?
所有字元都會被跳脫,包括字母、空格與換行,整段文字會縮成一行:「A b」加一個換行再加「c」會變成 \u0041\u0020\u0062\u000a\u0063。十六進位數字一律小寫並補足四位。
解碼看得懂哪些跳脫寫法?
三種:恰好四位十六進位數字的 \uXXXX、位數不限的 \u{…}(JavaScript 表示 FFFF 以上碼位的寫法),以及兩位數字的 \xXX。把「\u{1F600} \u00e9 \x41」解碼會得到 😀 é A。編碼本身不會產生 \u{…} 或 \x 寫法;沒有反斜線跳脫的文字經過解碼也會原樣不變。
本站相關工具
- 正規表示式測試器 — 測試 Regex 並查看所有符合結果
- XML 轉 JSON — 將 XML 元素與屬性轉換成 JSON
- 尋找與取代 — 一次批量替換重複的文字或片語
延伸閱讀: 清理從別處貼上的文字
以上步驟全部在這個頁面內完成,Unicode 跳脫字元轉換 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。