About URL Encoding
URLs are not allowed to contain just any character. Spaces, non-ASCII letters, and a handful of reserved symbols (&, =, ?, #, +, and others) have special meaning and must be escaped whenever they appear inside a value rather than as part of the URL structure. URL encoding — also called percent-encoding — replaces each offending byte with a % followed by its two-digit hexadecimal code.
Most modern frameworks encode URLs for you, but encoding still comes up constantly: pasting a query parameter into a browser by hand, building an OAuth redirect URL, constructing a search link to share, or debugging why a server is receiving the wrong value. This tool lets you encode and decode both whole URLs and individual components without having to drop into a shell or browser console.
Two slightly different functions exist in JavaScript: encodeURI treats things like : / ? & as structural characters and leaves them alone, while encodeURIComponent escapes everything that is not a plain letter, digit, or a small set of symbols. This tool uses the component-level encoding, which is what you almost always want when building a query parameter or path segment.
How to Encode and Decode URLs
- Paste a URL or URL fragment into the input field.
- Choose encode to escape unsafe characters, or decode to reverse percent-encoded sequences back to their original characters.
- Copy the result with the copy button.
- For full URLs, encode individual query parameter values rather than the whole URL — encoding the whole URL will mangle the ? and & separators.
Examples
Encoding a search query
Input
hello world & friends
Output
hello%20world%20%26%20friends
Decoding a query string value
Input
name%3DAda%26role%3Dadmin
Output
name=Ada&role=admin
Non-ASCII characters
Input
café
Output
caf%C3%A9
Percent-encoding works byte by byte over the UTF-8 representation. The character é is two bytes, C3 A9, and each is encoded separately.
Common Use Cases
- Building a search URL with spaces or special characters in the query.
- Constructing OAuth or API redirect URLs that need to survive being passed as a query parameter.
- Debugging webhook URLs that contain tokens with reserved characters.
- Sharing a URL in a context (chat message, email, QR code) that might otherwise interpret special characters.
Tips
- Encode values, not structure. If you encode a full URL including the :// and the ?, the result will no longer be a valid URL — it will be a string that needs further escaping to fit anywhere.
- A space can appear as either %20 or +, depending on context. %20 is correct everywhere; + is only valid inside the query string. If in doubt, use %20.
- Never double-encode. If a value already contains %20, encoding it again gives you %2520, which usually breaks things.
Frequently Asked Questions
Why do some URLs have + for spaces and others have %20?
Both are valid but in different places. + for space is a form-encoding convention used in query strings; %20 works anywhere. Most tools today normalise to %20 to avoid the ambiguity.
What characters actually need to be encoded?
Anything that is not an unreserved character. The unreserved set is letters, digits, and - _ . ~. Everything else — spaces, reserved characters, non-ASCII, control bytes — should be percent-encoded when it appears inside a component.
Is percent-encoding the same as HTML entity encoding?
No. Percent-encoding escapes for URLs; HTML entities (like &) escape for HTML. They solve different problems and are not interchangeable.
Is my URL sent to a server?
No. Encoding and decoding happen entirely in your browser.