K
ken
HomeArticles🕐 Time Converter📋 JSON Tools🖼️ Base64 Image🔑 Password Generator Cron Expression🔤 Case Converter📱 QR Code#️⃣ Hash🔡 Encoding🔍 Regex Tester⚙️ Config Convert🔐 Encrypt/Decrypt⚖️ BMI Calculator🎲 Random Data🗜️ Image Tools🌍 World Clock🏛️ Roman Numeral🔢 Number to Chinese💰 Loan Calculator

Encoding

Encoding is not encryption — it doesn't protect data; it solves the problem of "how to safely handle special characters in computers." URL encoding converts Chinese characters and special symbols to %XX format for safe URL transmission. Unicode encoding converts non-ASCII characters to \uXXXX format for use in JavaScript source code. A daily tool for every web developer.

Bidirectional Unicode and URL percent-encoding/decoding. Type Chinese to instantly get \uXXXX format; paste a percent-encoded URL to decode it back to readable text. All processing is client-side.

📖 Encoding Converter Guide

What Is Encoding?

Encoding converts characters into specific formats for transmission and storage in computer systems. Encoding is not encryption — it provides no security; anyone can decode it. This tool supports two essential web encoding types: URL encoding (converting special characters to %XX format for safe URL transmission) and Unicode encoding (converting non-ASCII characters to \\uXXXX escape sequences for JavaScript source and JSON serialization).

URL Encoding Explained

  • Rules: URLs allow only a subset of ASCII. Everything else (Chinese, spaces, symbols) must be percent-encoded as %XX where XX is the hex UTF-8 byte value.
  • encodeURI vs encodeURIComponent: encodeURI preserves URL structure chars (:/?#[]@) for full URLs. encodeURIComponent encodes everything — use it for individual parameter values.
  • Common trap: Using encodeURIComponent on a full URL encodes :// as %3A%2F%2F. Using encodeURI on a query parameter value may leave & unencoded, silently breaking the URL.

Unicode Encoding Explained

  • \uXXXX format: BMP characters use 4 hex digits. Example: U+4E2D (中) → \u4e2d.
  • \u{XXXXX} format: Characters beyond BMP (like emoji 😀 U+1F600) use ES6 \u{1F600} or surrogate pairs \uD83D\uDE00.
  • JSON and Unicode: The JSON spec requires \uXXXX escaping for non-ASCII, though most parsers accept raw UTF-8. Unicode escaping is necessary when embedding JSON in pure ASCII environments.