URL Encoder / Decoder
Encode special characters in URLs (percent-encoding) or decode encoded URLs back to readable text.
Essential for developers, SEO, and web tools.
What Is URL Encoding? URL encoding (also called percent-encoding) is the process of converting characters that are not allowed or have special meaning in URLs into a safe format. Each character is replaced by a percent sign (%) followed by two hexadecimal digits representing the character’s byte value in UTF-8. A space becomes %20, an exclamation mark becomes %21, the copyright symbol © becomes %C2%A9 (two bytes in UTF-8, thus 6 encoded characters).
Why URL Encoding Is Required RFC 3986, the standard that defines Uniform Resource Identifiers, specifies exactly which characters are allowed in URLs. Only unreserved characters (A–Z, a–z, 0–9, hyphen, underscore, period, tilde) can appear unencoded. Reserved characters (colon, slash, question mark, ampersand, equals, hash, etc.) have special syntactic meaning in URLs and must be encoded when they appear as literal data. Any other character — spaces, international letters, emoji — must always be encoded.
Two Different Encoding Functions Web developers work with two related encoding functions. encodeURI() encodes an entire URL while preserving its structure: it leaves : / ? # & = + $ , ; @ ! ’ ( ) * intact because these characters structure the URL itself. Use it when encoding a complete URL. encodeURIComponent() encodes everything except unreserved characters — it’s designed for encoding the VALUE in a query parameter. For example, if a search query contains & (ampersand), encodeURIComponent() will encode it as %26 so it doesn’t break the URL’s query string structure.
Common Developer Mistakes Double-encoding is a frequent bug: encoding a URL that already contains encoded sequences, turning %20 into %2520 (the % itself gets encoded to %25). Servers may then decode the URL twice and produce garbage. Another mistake: assuming + means a space (it does in HTML form data, but NOT in general URLs — use %20 instead). Forgetting to encode the path separating slashes vs. slashes in filenames causes confusion when filenames contain slashes.
UTF-8 and International Characters All modern browsers and servers use UTF-8 for URL encoding. A Chinese character like 中 is 3 bytes in UTF-8 (0xE4 0xB8 0xAD), so it encodes to %E4%B8%AD — a 9-character representation. URLs for non-English content can become very long when fully encoded. Internationalized Domain Names (IDNs) handle this at the DNS level using Punycode encoding.
SEO Implications Search engines prefer clean, readable URLs. While encoded URLs work, they look less trustworthy to users and can be harder to share. Most CMS systems (WordPress, Hugo, etc.) automatically create clean URLs from content titles by replacing spaces with hyphens and removing special characters entirely — a better approach than percent-encoding for page URLs.