Skip to main content
UE

URL Encode & Decode

Encode text for safe inclusion in URLs and decode percent-encoded strings back to readable text instantly.

Did you like the tool? Thanks!
Share:

How to Use URL Encode & Decode

Paste text into the input box and choose Encode to percent-encode it for use in URLs, or paste a percent-encoded string and choose Decode to see the original. The tool uses the standard JavaScript encodeURIComponent and decodeURIComponent functions, which handle every character that is not safe in a URL component. A Copy button grabs the result instantly.

About URL Encode & Decode

URL encoding (also called percent-encoding) is how the web transports characters that are not safe to appear literally in a URL. A URL can only contain a specific set of characters — letters, digits, and a handful of punctuation marks (hyphen, underscore, period, tilde) — without being ambiguous or breaking the URL parser. Everything else — spaces, slashes that are not path separators, question marks that are not query-string delimiters, ampersands, hash signs, and non-ASCII characters — must be percent-encoded: replaced with a % followed by two hexadecimal digits representing the byte value of the character in UTF-8.\n\nFor example, a space becomes %20, a forward slash becomes %2F, and the Euro sign becomes %E2%82%AC (its 3-byte UTF-8 encoding in hex). This is what happens behind the scenes every time you type a search query into Google — the browser percent-encodes it and appends it to the URL as the q= parameter — and every time an API call includes a value that might contain special characters. If you have ever seen %20 or %3D in your browser's address bar, you have seen URL encoding in action.\n\nThere is an important distinction between encodeURI and encodeURIComponent that trips people up. encodeURI is designed for encoding a full URL, so it leaves many characters intact — colon, slash, question mark, ampersand, hash, equals, and more — because they serve structural roles in the URL itself. encodeURIComponent is designed for encoding a single value that will be placed inside a URL component (a query parameter value, a path segment), and it encodes EVERYTHING that is not 100% safe, including the structural characters. Using the wrong one is a common bug: encodeURI leaves spaces as literal spaces (invalid in a URL), while encodeURIComponent correctly turns them into %20. This tool uses encodeURIComponent by default because the most common use case is encoding a single value — a search term, a username, a filename, or any piece of data that will become one query parameter.\n\nReal-world scenarios where you need URL encoding: manually constructing an API URL with query parameters from user input, creating a redirect URL with dynamic values, building a mailto: link with a subject and body, encoding special characters in a filename for a download link, or percent-encoding OAuth callback parameters. In every case, skipping URL encoding means the URL either breaks, produces a 400 Bad Request, or silently truncates at the first unencoded special character. This tool gives you a quick, reliable way to encode and decode without memorising percent-code tables or guessing which characters need escaping.

Details & Tips

The JavaScript functions this tool relies on (encodeURIComponent and decodeURIComponent) follow RFC 3986, the current standard for URI syntax. encodeURIComponent encodes every character EXCEPT A-Z, a-z, 0-9, hyphen, underscore, period, exclamation mark, tilde, asterisk, apostrophe, and parentheses. That is a deliberately conservative list — everything else gets percent-encoded.\n\nUTF-8 percent-encoding for non-ASCII characters works by encoding each byte of the UTF-8 representation individually. The Greek letter omega (Ω, code point U+03A9) has a two-byte UTF-8 representation: CE A9 in hex, so it becomes %CE%A9 when percent-encoded. The emoji smiling face (U+1F60A) has a four-byte UTF-8 representation: F0 9F 98 8A, becoming %F0%9F%98%8A. This is why some URLs look like they are full of unintelligible percent sequences — they are carrying perfectly valid Unicode text, just in a form the URL transport can handle.\n\nEdge cases this tool handles: empty input simply produces an empty result. Input that contains invalid percent sequences (for example %ZZ, %G1, or a truncated % at the end) triggers a clean error message rather than silently producing garbage. The decode step uses decodeURIComponent with a try/catch, so any string that the browser's URI decoder cannot handle is flagged with the specific cause shown.\n\nA practical workflow: if you need to build a URL with a query parameter from user input, encode the value first with this tool, then concatenate it. Example: https://example.com/search?q= + encodeURIComponent(userInput). Sending unencoded user input directly into a URL is a reliable source of broken links, 400 Bad Request responses, and subtle security issues — URL encoding is the fix every time.

Frequently Asked Questions

What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URL and leaves structural characters (colon, slash, question mark, ampersand, hash, equals) intact. encodeURIComponent encodes a single value for use inside a URL component and encodes everything except safe characters. This tool uses encodeURIComponent by default.
Why does a space become %20 and not a + sign?
%20 is the correct percent-encoding for a space in most URI contexts (RFC 3986). The + sign for spaces is specific to the application/x-www-form-urlencoded format used in HTML form submissions. For query strings, %20 is standard.
Can I decode a URL that contains non-Latin characters like Chinese or Arabic?
Yes. Percent-encoding handles UTF-8, so multi-byte characters are encoded as sequences of percent-hex pairs (3 or 4 percent sequences per character) and decoded back correctly by this tool.
What happens if I encode an already-encoded string?
The percent signs themselves get encoded — %20 becomes %2520 because % is percent-encoded as %25. This is called double-encoding. Always decode first to see if the string is already encoded before encoding again.
Why do I get an error when decoding?
The string likely contains an invalid percent sequence — for example %ZZ where ZZ is not valid hexadecimal, or a truncated % at the end with no two hex digits following. Check for malformed percent sequences.
Is my text sent to a server when I encode or decode?
No. All operations run in your browser using JavaScript — nothing you type or paste is transmitted, logged, or stored anywhere.
Should I encode the entire URL or just the parameter values?
Encode just the parameter values. If you encode the entire URL, the structural characters (://, /, ?, &) become percent-encoded and the URL will not work. Use this tool on the individual query parameter values, not the full URL.
Can I use this for encoding data in a form submission?
Browsers handle form encoding automatically when you submit a form. This tool is useful when you are manually building a URL (for example, for an API call, a redirect link, or a curl command) and need to encode specific parameter values.
Does this tool handle internationalized domain names (IDN)?
No — IDN encoding (Punycode) is a different mechanism for encoding entire domain names with non-ASCII characters and is handled at the DNS level. This tool encodes URL component values, not domain names.
Are there any characters that are safe to leave unencoded in a URL?
Unreserved characters per RFC 3986: A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~). These can appear literally anywhere in a URL. Everything else should be percent-encoded when used outside its designated structural role.

Part of These Collections

Also Available As

url encoder, url decoder, url encode online, url decode online, percent encoding, encodeURIComponent, url escape, url unescape

Found a Problem?

Let us know if something with URL Encode & Decode isn't working as expected.

Thanks — we'll take a look.