π URL Encoder
Percent-encode special characters for safe use in URLs, or decode percent-encoded strings back to readable text.
How to Use the URL Encoder
The URL Encoder/Decoder tool lets you percent-encode special characters for safe use in URLs and decode percent-encoded strings back to readable text. To encode, paste your text or URL query string into the left panel and click Encode. Characters that are not allowed in URLs β such as spaces, &, =, ?, #, and non-ASCII characters β are replaced with their percent-encoded equivalents (for example, a space becomes %20). To decode, paste a percent-encoded string and click Decode to restore the original characters.
URL encoding is essential when building query parameters, form submissions, and REST API requests. For example, if you pass a search query like "hello world" as a URL parameter, it must be encoded as hello%20world to avoid breaking the URL structure. This tool uses JavaScript's encodeURIComponent function, which encodes all characters except unreserved characters (AβZ, aβz, 0β9, -, _, ., ~). All processing happens locally in your browser β nothing is sent to a server.
Frequently Asked Questions
What is URL encoding?
βΊ
URL encoding (also known as percent-encoding) is the process of converting characters that are not allowed or have special meaning in a URL into a format that can be safely transmitted. Each unsafe character is replaced with a percent sign (%) followed by its two-digit hexadecimal ASCII code. For example, a space is encoded as %20 and a # is encoded as %23.
What is the difference between encodeURI and encodeURIComponent?
βΊ
encodeURI encodes a complete URL but leaves characters that are part of the URL structure β such as /, :, ?, and # β unchanged. encodeURIComponent encodes every special character including those, making it suitable for encoding individual query parameter values. This tool uses encodeURIComponent, which is correct for encoding values within a URL, not the entire URL.
Why does a space sometimes appear as + instead of %20?
βΊ
HTML forms encode spaces as + in the application/x-www-form-urlencoded format, which is used by default for form submissions. Spaces in the path or query string of a URL should use %20. When decoding, both + and %20 are treated as spaces by most web servers.
Which characters need to be URL encoded?
βΊ
Characters that must be percent-encoded in a URL include: space ( ), !, ", #, $, %, &, ', (, ), *, +, comma, /, :, ;, =, ?, @, [, and ]. Non-ASCII characters (like accented letters or emoji) must also be encoded. Unreserved characters β letters, digits, hyphen, underscore, period, and tilde β do not need encoding.