TFT

Unicode Escape Encoder & Decoder

Encode text to Unicode escape sequences for programming, or decode escapes back to readable text. Supports syntax for JavaScript, Python, Java, and C.

Unicode Escape Sequence Encoder/Decoder

Encode text to Unicode escape sequences and decode them back to text

Format Examples

Unicode
\u0048\u0065\u006C\u006C\u006F
JavaScript
\u0048\u0065\u006C\u006C\u006F
Python
\u0048\u0065\u006C\u006C\u006F or \U0001F600
HTML Entity
Hello
CSS
\000048 \000065 \00006C \00006C \00006F

How the Unicode Escape Encoder Works

Enter text to convert Unicode characters to escape sequences. Choose the format: JavaScript (\\uXXXX), Java (\\uXXXX), Python (\\uXXXX or \\UXXXXXXXX), HTML (&#xXXXX;), or CSS (\\XXXX).

Each Unicode character converts to its escape sequence. 'A' becomes \\u0041. Emoji become \\uD83D\\uDE00 or \\u{1F600}. The output is ASCII-safe text.

Decode escape sequences back to Unicode. The decoder auto-detects the format. Handles mixed escape sequences. Essential for working with Unicode in code.

When You'd Actually Use This

Writing portable source code

Source files with Unicode may have encoding issues. Escape special characters. Code works regardless of file encoding. Better portability.

Creating string literals

Strings with special chars in code? Escape them. Prevents syntax errors. Works in any editor. Safe for version control.

Debugging encoding issues

Garbled text in logs? Encode to escapes to see actual code points. Identify the characters. Debug encoding problems.

Working with JSON

JSON supports \u escapes. Encode Unicode for safe JSON. Ensures compatibility. All JSON parsers handle escapes.

Documenting character usage

Technical docs need precise character references. Use U+XXXX notation. Unambiguous identification. Professional documentation.

Processing legacy data

Old systems may have escaped Unicode. Decode for modern processing. Convert between formats. Data migration support.

What to Know Before Using

Different languages use different escapes.JavaScript: \uXXXX. Python: \uXXXX or \UXXXXXXXX. HTML: &#xXXXX;. Choose the format for your context.

Surrogate pairs for emoji.Emoji need two escapes in some formats. \\uD83D\\uDE00 for πŸ˜€. Newer syntax: \\u{1F600}. Depends on language.

Escapes are ASCII-safe.Output contains only ASCII characters. Safe for any system. No encoding issues. Universal compatibility.

Case doesn't matter for hex.\u0041 and \u0041 are identical. Lowercase is common. Uppercase traditional. Both decode the same.

Pro tip: For modern JavaScript, prefer \u{XXXXX} for characters above U+FFFF. Cleaner than surrogate pairs. Requires ES6+ but much more readable.

Common Questions

What's \uXXXX format?

Unicode escape sequence. \u followed by 4 hex digits. \u0041 is 'A'. Standard in many programming languages.

How do I encode emoji?

Emoji are above U+FFFF. JavaScript: \\uD83D\\uDE00 (surrogate pair) or \\u{1F600}. Python: \\U0001F600. HTML: 😀.

Can I mix escape formats?

The decoder handles mixed input. \u0041 and A both decode to 'A'. Output uses your selected format.

Why escape Unicode?

Portability. Escapes work in any file encoding. Raw Unicode needs UTF-8 files. Escapes are ASCII-safe.

What's the difference from UTF-8?

UTF-8 is a byte encoding. Escapes are source code representation. Different purposes. Can represent same characters.

How do I decode in code?

Most languages decode escapes automatically in string literals. For runtime decoding, use language-specific functions.

Are escapes reversible?

Yes, perfectly. Encode then decode returns original. Lossless conversion. No information lost.