URL Encoder & Decoder
Encode special characters for URLs or decode percent-encoded strings back to readable text.
No data sent to serverRelated Tools
What is URL Encoding?
URL encoding (also called percent-encoding) is a mechanism for converting characters that are not allowed in a URL into a format that can be transmitted over the internet. Special characters like spaces, ampersands (&), and non-ASCII characters are replaced with a percent sign (%) followed by their hexadecimal byte values.
For example, a space becomes %20, an ampersand becomes %26, and the Japanese character "東" becomes %E6%9D%B1. URL encoding is defined by RFC 3986 and is essential for building valid query strings, form submissions, and API requests.
This tool uses JavaScript's encodeURIComponent() for encoding, which encodes all characters except A-Z a-z 0-9 - _ . ~ ! * ' ( ). For decoding, it uses decodeURIComponent() to restore the original text.
How to Use
- Paste your plain text or URL-encoded string into the input box.
- Click "Encode" to percent-encode the text, or "Decode" to convert it back.
- Copy or download the result.
Common scenarios
- Query parameters:
?q=hello world→?q=hello%20world - OAuth redirect URIs: nested URLs need double encoding
- mailto: links:
mailto:foo@bar.com?subject=Hi%20there - tel: / sms: deep links: phone numbers with spaces need encoding
- Filenames in CDN URLs:
My File.pdf→My%20File.pdf - API key parameters: special characters in keys must be encoded
Common pitfalls
- Double encoding: encoding an already-encoded string.
%20becomes%2520— annoying bug - + vs %20: form data (
application/x-www-form-urlencoded) uses+for spaces; URI encoding uses%20. This tool uses%20(URI standard) - Encoding the wrong slash:
/in path segments shouldn’t be encoded. Only encode individual segment values - Path traversal in decoded input:
%2e%2e%2fdecodes to../— always validate decoded values before filesystem use
Why URLs Cannot Just Contain Text
A URL is not a string that gets passed along untouched — it is a structured address, and a small set of characters have jobs inside that structure. A question mark begins the query. An ampersand separates parameters. An equals sign splits a name from its value. A slash separates path segments. A hash begins the fragment.
So if a value you want to send happens to contain one of those characters, it has to be disguised, or it will be read as punctuation. Percent-encoding does the disguising: the character is replaced by a percent sign and its byte value in hexadecimal. A space becomes %20, an ampersand becomes %26, a slash becomes %2F.
This is why a search for “fish & chips” arrives correctly instead of being read as two separate parameters.
The Two Encoders, and the Mistake Everyone Makes
JavaScript has two functions and choosing wrongly is the single most common source of broken links.
encodeURIComponent encodes almost everything, including /, ?, &, and =. Use it for a value that goes inside a URL — a search term, a redirect target, a filename.
encodeURI deliberately leaves the structural characters alone, because it is meant for encoding a whole URL that already has valid structure. Use it when you have a complete address containing spaces or non-Latin characters.
The classic bug: building a redirect parameter with encodeURI. The slashes and question marks in the target URL survive unencoded, the browser reads them as part of the outer URL, and the redirect silently goes somewhere else. Values go through encodeURIComponent; complete URLs go through encodeURI.
Plus Signs, Double Encoding, and Other Traps
The plus sign problem. In the query string of an HTML form submission, + historically means a space. In the path, it means a literal plus. So C++ in a query can arrive as C if something decodes it the form way. Encoding it as %2B removes the ambiguity.
Double encoding. Encoding an already-encoded string turns %20 into %2520, because the percent sign itself gets encoded. If you see %25 appearing in your URLs, something in the chain is encoding twice.
Non-Latin text. Characters outside ASCII are encoded as their UTF-8 bytes, so a single Korean or Japanese character becomes three percent-escapes. That is correct, if verbose.
FAQ
What is the difference between encodeURI and encodeURIComponent?
encodeURI() encodes a full URI but leaves reserved characters like : / ? # & intact — for whole URLs. encodeURIComponent() (used by this tool) encodes those too — for individual query parameter values or path segments. Rule: use encodeURIComponent for one piece at a time.
Why do I need to URL-encode query parameters?
Characters like &, =, ?, # have special meaning in URL syntax. If your parameter values contain them, they must be encoded so the URL parser doesn’t misinterpret them as separators.
Does it handle Unicode characters?
Yes — Korean, Chinese, emoji, and accented characters all encode correctly. They’re UTF-8 encoded first (3 bytes per Korean char, 4 bytes per emoji), then each byte is percent-encoded.
Why does + sometimes appear instead of %20?
HTML form submissions (application/x-www-form-urlencoded) use + for spaces. URI percent-encoding uses %20. This tool always produces %20 — the URI standard. If you need +, manually replace after encoding.
Should I encode the entire URL?
No — only encode the parts that are data (query parameter values, path segments). Encoding the entire URL (including :/?) breaks routing. encodeURI() is for whole URLs; encodeURIComponent() for individual pieces.
What’s the maximum URL length?
HTTP spec doesn’t define a limit, but most servers and browsers cap around 2,048 characters. Long URLs can fail silently or cause 414 (URI Too Long) errors. For long parameters, use POST instead of GET.
When should I use encodeURIComponent instead of encodeURI?
Use encodeURIComponent for values placed inside a URL, such as search terms or redirect targets, because it encodes the structural characters too. Use encodeURI only for a complete URL that already has valid structure and merely contains spaces or non-Latin characters.
Why does %2520 keep appearing?
Something is encoding an already-encoded string. The percent sign of %20 gets encoded to %25, producing %2520. Find and remove the duplicate encoding step rather than decoding twice to compensate.
Is + the same as %20?
Only in form-submitted query strings, where + historically means a space. Elsewhere it is a literal plus sign. Encoding a real plus as %2B avoids the ambiguity entirely.
Why does one Korean character become three escapes?
Characters outside ASCII are encoded as their UTF-8 bytes, and most non-Latin characters take three bytes. The result is verbose but correct and universally understood.
⚠️ Reference Only
Output is generated based on your input and is provided for reference. Results may vary depending on your specific use case, edge cases, or environment-specific behavior. We do not guarantee accuracy of conversions, validations, or computed values.
Always verify critical outputs against official documentation or production environments. We are not responsible for any decisions or losses based on these tool results.