Unicode Converter
Convert text and Emojis to Unicode code points, JavaScript escape sequences, and CSS content codes.
Original Text / Emoji
JavaScript / JSON Format (\\uXXXX)
CSS Content Format (\\XXXX)
Code Points (decimal or hex, e.g., 72,101 or 0x48)
What is the Unicode Converter?
The **Unicode Converter** is an essential developer utility designed to translate plain text, symbols, and emojis into their corresponding machine-readable formats. Specifically, it converts characters into **hexadecimal code points**, **JavaScript/JSON escape sequences** (`\uXXXX`), and **CSS content codes** (`\XXXX`).
Unicode itself is the universal character encoding standard that assigns a unique number (a code point) to every character in every language, script, and symbol. This ensures consistent text representation across all digital platforms, from iPhones to Androids, and from Windows to Linux. This tool acts as a bridge, allowing you to reveal and manipulate the underlying code behind the glyphs you see on screen, making it indispensable for web development and software localization.
Why Should You Use This Tool?
Developers frequently encounter scenarios where raw text cannot be used directly. The Unicode Converter solves these specific problems:
- CSS Pseudo-elements: When adding icons or special characters to `::before` or `::after` content in CSS, you cannot simply paste the character. You must use the hexadecimal escape sequence (e.g., `\2605` for a star). This tool generates that code instantly.
- JavaScript String Safety: Inserting special characters directly into JavaScript strings can sometimes cause encoding issues or make code hard to read. Using the `\uXXXX` escape sequence ensures your code is ASCII-safe, portable, and resistant to encoding errors during file transfers.
- Debugging Data Integrity: If you have ever seen "Mojibake" (garbled text like `Γ’ΛΒΊ`), it is often due to an encoding mismatch. Converting text to its raw code points helps you identify exactly what characters are present, distinguishing between visually identical glyphs (like a Cyrillic 'a' vs. Latin 'a').
- JSON & API Payloads: When working with JSON APIs, ensuring special characters are properly escaped prevents parsing errors and ensures data is transmitted correctly across different systems.
How to Use the Unicode Converter
This tool is bidirectional and updates in real-time. Here is a step-by-step guide:
Step 1: Input Your Text
Type or paste your text (including Emojis like π or π) into the **"Original Text"** box. The tool processes it instantly as you type.
Step 2: Get JavaScript/JSON Format
Copy the output from the second box (e.g., `\uD83C\uDF89`) to use in your JS strings or JSON data files. This format automatically handles surrogate pairs for emojis (characters outside the Basic Multilingual Plane).
Step 3: Get CSS Content Format
Use the third box output (e.g., `\1f389`) for your CSS files. This format is ready to be pasted into a content property like `content: "\1f389";`.
Step 4: View Raw Code Points
The final box shows the raw decimal or hexadecimal values (e.g., `0x1F389`), which is useful for backend processing (C++, Java, Python) or database storage.
Step 5: Reverse Conversion
You can also type code points or escape sequences directly into any of the output boxes to reverse-engineer the original text.
Frequently Asked Questions (FAQ)
Q: What is the difference between UTF-8 and Unicode?
A: Unicode is the *standard* that assigns integers to characters. UTF-8 is an *encoding* that transforms those integers into binary data (bytes) for storage. This tool focuses on the Unicode code points (the integers).
Q: Why do emojis appear as two codes (e.g., `\uD83D\uDE00`) in JavaScript?
A: JavaScript uses UTF-16 encoding. Characters with code points above 65535 (like most emojis) cannot fit into a single 16-bit unit, so they are represented as a "surrogate pair" of two 16-bit values. This tool handles this automatically.
Q: Can I use the decimal values for HTML entities?
A: Yes! The decimal values shown in the "Code Points" section are the same numbers used in HTML entities. You can simply wrap the decimal number in `&#...;` (e.g., `π`) to display the character in HTML.
Q: Does this support all languages?
A: Absolutely. Because it uses the browser's native Unicode support, it can handle Chinese, Arabic, Cyrillic, Hebrew, and any other script supported by the Unicode standard.