Unicode Converter
Turn text into the Unicode codes that programs and web pages use, or turn such codes back into readable text. Ten formats are supported, from U+ code points and \u escapes to UTF-8 bytes, and mixed escapes in a piece of text are decoded in one go.
About Unicode Converter
Every character has a number in the Unicode standard: the Indian rupee sign is 8377, written U+20B9 in hexadecimal. Programming languages, file formats and web pages each write those numbers their own way. This converter translates between readable text and ten of those notations, in both directions.
Formats
| Format | ₹ looks like |
|---|---|
| Code points | U+20B9 |
| JavaScript, JSON, Java | \u20B9 |
| JavaScript ES6 | \u{20B9} |
| Python | \u20b9 |
| CSS | \20B9 |
| HTML decimal / hex | ₹ / ₹ |
| UTF-8 bytes | E2 82 B9 |
| UTF-16 units | 20B9 |
| Decimal | 8377 |
For escape-style formats, a tick box leaves plain English letters, digits and punctuation alone, so Price ₹500 becomes Price \u20B9500 rather than a wall of codes.
Worked example: an emoji
Convert 😀 to the JavaScript format and you get \uD83D\uDE00. That is not a mistake: characters above U+FFFF need two UTF-16 code units, a surrogate pair. The ES6 format writes the same character as \u{1F600}, Python as \U0001f600, and UTF-8 as the four bytes F0 9F 98 80.
Decoding
Switch the direction to turn codes back into text. The “escapes in text” choice handles a mix of \uXXXX, surrogate pairs, \u{…}, \UXXXXXXXX, \xXX, U+XXXX and numeric HTML codes inside ordinary text, so a JSON string such as "caf\u00e9 \u20b9200" reads café ₹200. Codes that would produce an impossible character are left exactly as typed.
For byte lists, choose UTF-8 bytes. Spaces, commas, 0x, \x and % prefixes are all accepted, so %E0%A4%A8 decodes to न. If the bytes do not form valid UTF-8, for example when the last byte of a character is missing, you get an error instead of garbled output.
Switching direction carries the result over and picks the matching format, so a round-trip check takes one click.
Related tools
Named entities such as belong in HTML Entity Encoder and Decoder. To identify a mystery character, paste it into Unicode Inspector.
How to use Unicode Converter
- Choose a direction: text to codes, or codes to text.
- Paste your text or codes and pick the format.
- Copy the result or download it.
Privacy: how it works
Everything happens in your browser. Your text is not sent to any server.
Frequently asked questions
Why does an emoji become two \u codes in JavaScript?
JavaScript, JSON and Java store text in UTF-16, where characters above U+FFFF, such as most emoji, take two code units called a surrogate pair. The ES6 \u{1F600} form writes them as one code.
Which escapes does the decoder understand?
In “escapes in text” mode it decodes \uXXXX (including surrogate pairs), \u{…}, \UXXXXXXXX, \xXX, U+XXXX and numeric HTML codes such as ₹, and leaves other text alone.
What is the difference between UTF-8 and UTF-16 output?
Both are ways to store the same characters as numbers. UTF-8 uses 1 to 4 bytes per character and is used by most files and web pages; UTF-16 uses 2 or 4 bytes and is used inside Windows, Java and JavaScript.