URL Encoder / Decoder

Encode special characters in URLs for safe transmission, or decode percent-encoded URLs back to readable text. Everything runs locally in your browser.

Your result will appear here...

How to Use the URL Encoder/Decoder

Paste a URL or text string into the input area, then choose an action. Encode converts special characters (spaces, ampersands, non-ASCII characters, etc.) into their percent-encoded equivalents using encodeURIComponent(), which is ideal for encoding individual query parameter values. Encode Full URL uses encodeURI(), which preserves URL-structural characters like ://, /, ?, and & while encoding everything else. Decode reverses percent-encoding back to the original human-readable text. Click "Copy" to copy the result or "Clear" to reset.

What Is URL Encoding (Percent-Encoding)?

URL encoding, formally known as percent-encoding, is a mechanism defined in RFC 3986 for representing characters in a URI that are not allowed or have special meaning. In a URL, only a limited set of ASCII characters are safe to use directly: letters (A–Z, a–z), digits (0–9), and a few special characters (-, _, ., ~). All other characters — including spaces, non-ASCII characters, and reserved characters like &, =, ?, and # — must be encoded as a percent sign followed by their hexadecimal byte value (e.g., a space becomes %20, an ampersand becomes %26).

encodeURIComponent vs. encodeURI

JavaScript provides two built-in functions for URL encoding, and choosing the right one matters. encodeURIComponent() encodes almost everything except unreserved characters — it's designed for encoding individual values like query parameters or path segments. For example, encoding key=hello world&lang=en produces key%3Dhello%20world%26lang%3Den. In contrast, encodeURI() is designed for encoding a complete URI while preserving its structure — it leaves ://, /, ?, &, =, and # intact. Use encodeURIComponent() for parameter values, and encodeURI() when you want to encode a full URL string.

Common Use Cases

URL encoding is essential in nearly every web application. When building query strings dynamically, each parameter value must be encoded to prevent special characters from breaking the URL structure. Form submissions with application/x-www-form-urlencoded content type require all field values to be percent-encoded. Internationalized domain names (IDN) and URLs containing non-Latin characters (Chinese, Japanese, Arabic, etc.) need encoding for proper resolution by browsers and servers. API developers routinely encode parameters when constructing request URLs. Redirect URLs passed as parameters need double-encoding to prevent premature interpretation of their own query strings.

Debugging URL Issues

Malformed URLs are a frequent source of bugs in web applications. Double-encoding (encoding an already-encoded URL) produces confusing strings like %2520 instead of %20. Missing encoding causes ampersands in parameter values to be mistaken for parameter separators, silently truncating data. This tool helps you debug these issues by letting you decode URLs step by step to see exactly what each percent-encoded sequence represents, making it easy to spot double-encoding, missing encoding, or corrupted URL structures.