Unicode escape sequence converter
Type Hi and get \u0048\u0069; an accented é becomes \u00e9 and the emoji U+1F600 becomes the pair \ud83d\ude00. Decoding turns such sequences back into readable text and refuses broken escapes instead of guessing. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- Hi
- Calculation mode
- Encode
- Result
- \u0048\u0069
- Length
- 12
- Code units
- 2
- Escape count
- 2
A simple letter becomes \u0041, an accented character becomes \u00e9, and characters outside the Basic Multilingual Plane—emoji, rare historic scripts, many modern symbols—appear as a high and low surrogate pair such as \ud83d\ude00. Pasting those sequences into a document by hand is slow and error-prone; decoding a truncated or non-hex escape can silently invent the wrong character if a tool is too lenient. This capability encodes plain text into contiguous \uXXXX sequences and decodes escape-heavy strings back into readable characters with full surrogate-pair awareness.
What a \uXXXX escape actually stands for
The classic escape is a backslash, the letter u and exactly four hexadecimal digits. JavaScript, Java and many data files use it to write any character with plain keyboard symbols. Each escape names one UTF-16 code unit, not a whole character, which is why a capital H is simply \u0048 while characters above U+FFFF, such as emoji and rare historic scripts, need two escapes: a high half from the D800 to DBFF range and a low half from DC00 to DFFF. The smiling face U+1F600 therefore becomes \ud83d\ude00, never a single six-digit escape.
Typical uses and the mistakes it catches
People reach for this when a string in source code, a resource file or a log shows \u sequences instead of letters, or when special characters must be written with plain keyboard symbols only. It also makes a good lesson on UTF-16: one emoji becomes two units, and decoding the pair brings back one character. Decoding is strict on purpose. A cut-off tail such as \u12, a body that is not hexadecimal such as \uGGGG, and unknown backslash escapes are rejected rather than guessed, because a lenient tool can silently invent the wrong character. Encoding always writes lowercase hex, and a valid high and low pair is joined back into one character.
How \uXXXX escapes map UTF-16 code units
Values from U+0000 through U+FFFF (excluding unpaired surrogate edge cases you may still emit as units) become a single escape such as \u0048 for capital H or \u00e9 for e-acute. Scalars from U+10000 through U+10FFFF are encoded as a surrogate pair: first a high surrogate in the range U+D800–U+DBFF, then a low surrogate in U+DC00–U+DFFF. The smiling face U+1F600 therefore becomes \ud83d\ude00, not a single six-digit escape.
Incomplete tails such as \u12, non-hex bodies such as \uGGGG, and unknown backslash escapes are rejected rather than guessed. Valid high-plus-low pairs recombine into one scalar via fromCodePoint so the round trip preserves emoji and supplementary-plane text.
What you can do with it
Teach UTF-16 and surrogate pairs
Show students that one emoji becomes two \uXXXX units, then decode the pair back so length and code-point concepts stick.
FAQ
What escape format does this tool use?
Non-BMP characters encode as a high and low surrogate pair (for example \ud83d\ude00).
Can I convert both ways?
Yes. Set mode to encode (default) to turn plain text into contiguous \uXXXX sequences, or mode to decode to expand escapes—including surrogate pairs—back into characters.
What happens on a malformed escape?
Truncated forms such as \u12, non-hex bodies, and unknown backslash escapes are rejected with a message that points at the problem. Validation failures are not charged.
Does it handle emoji and other non-BMP characters?
Yes. Encode emits a surrogate pair of two \uXXXX units; decode recombines a valid high+low pair into a single scalar so the round trip preserves the original emoji.
What does it cost?
The browser tool is free and runs locally.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/enc/unicode-escape \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hi café"}'const res = await fetch("https://api.kit.forhosting.com/enc/unicode-escape", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "Hi café"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/unicode-escape",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "Hi café"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/unicode-escape", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"Hi café"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"Hi café"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/unicode-escape", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "Hi café"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.unicode_escape",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Developers who debug JSON payloads, Java resource bundles, or JavaScript string literals constantly meet the backslash-u form: four hexadecimal digits after \u that stand for one UTF-16 code unit. The free browser tool and the paid API share one deterministic core, so classroom demos, CI checks, and live webhooks always agree on the same mapping at the published price of $0.002 per successful item.
How \uXXXX escapes map UTF-16 code units
Java, JavaScript, and the JSON string grammar all describe Unicode text with the same classic escape: a backslash, the letter u, and exactly four hexadecimal digits. That form does not name a full Unicode scalar by itself when the character sits above U+FFFF; instead it names a UTF-16 code unit. That design matches what you see inside JSON.stringify output, many Java Properties files, and older JavaScript source that predates the \u{…} code-point escape. This capability walks input with code-point awareness on encode, emits lowercase four-digit hex for every unit, and on decode scans for \u or \U followed by four hex digits.
What you send and what you get back
Send a required string field named text and an optional mode field set to encode or decode. Encode turns every character into contiguous \uXXXX units: Hi becomes \u0048\u0069, and a string that mixes ASCII with café and an emoji produces a longer but fully escaped result. Decode reverses the process: it replaces each well-formed \uXXXX with the matching code unit, recombines surrogate pairs into one character when both halves are present, and keeps literal characters that were never escaped so mixed pastes still work. When mode is omitted, encode is the default so a single payload still does useful work. Common JSON companions such as \n, \t, \r, \\, and \" are accepted on decode so a fragment copied from a string literal does not fail on the first newline escape. Success responses echo mode and the original text, return result as the primary output string, and include length, code_units (UTF-16 units processed), escape_count (how many \uXXXX forms were produced or consumed), a format label of \uXXXX, and a short standard note naming Java, JavaScript, and JSON. Missing text, unsupported mode values, strings longer than the documented maximum, truncated hex after \u, non-hex digits inside an escape, and unknown backslash sequences all fail with invalid_input and an English message that names the index or field. Validation failures do not consume prepaid balance. Pricing for successful API calls is the published base of $0.002 per item.
Where Unicode escape conversion shows up in real work
Mobile and desktop clients that talk to Java backends sometimes log Properties-style bundles full of \u sequences for every accented label; support teams paste those lines into a dedicated converter landing rather than hunting through IDE settings. Programming courses teach that JavaScript string length counts UTF-16 units, not user-perceived characters, and a live encoder that shows two escapes for one emoji makes that lesson concrete. If you need U-plus scalar lists without backslashes, raw UTF-16 hex dumps, percent-encoding for URLs, or HTML named entities, treat those as separate search intents and landings rather than overloading this Unicode escape sequence page—those tools answer different queries even when the underlying code is short. API and webhook authors often receive JSON where non-ASCII product names or user-generated captions appear fully escaped; decoding them into readable text speeds triage without spinning up a full application runtime. Because this capability is a pure parse engine, API pricing stays at the published base of $0.002 per successful item and failed validation does not consume balance.
Integration use cases
Decode escaped JSON and Java logs
Paste a log line full of \u00e9 and surrogate pairs, decode to readable text, then re-encode a corrected fixture for the next deploy.
Build CI golden strings for serializers
Encode product names and emoji captions into stable \uXXXX forms that JSON and Java string dumps must match after library upgrades.