What is URL Encoding?
URL encoding (also called percent-encoding) converts characters that are not allowed in a URL into a safe representation. Each unsafe character is replaced by a percent sign followed by two hexadecimal digits representing the character's ASCII code. For example, a space becomes %20 and an ampersand becomes %26.
How to Use the URL Encoder / Decoder
- Paste your text or URL into the input field.
- Choose Encode to convert it into a percent-encoded, URL-safe string.
- Choose Decode to turn a percent-encoded string back into readable text.
- Review the output, which updates as you work.
- Copy the result into your link, query string, API request, or code.
Why is URL Encoding Necessary?
URLs can only contain a limited set of ASCII characters. Characters outside this set — such as spaces, accented letters, and symbols like &, =, and ? — have special meanings or are simply not allowed. Without encoding, these characters can break links, corrupt query strings, or prevent servers from parsing the request correctly.
Encode vs. Decode
- Encode — converts plain text into a percent-encoded URL-safe string. Use this when building query parameters or passing user input as part of a URL.
- Decode — converts a percent-encoded string back to readable text. Use this when inspecting a URL you received from a server or a log file.
Where URL Encoding Matters
Encoding comes up constantly in web development. When you build a search link, the search term entered by a user — which may contain spaces, ampersands, or accented letters — must be encoded before it is appended to the URL, otherwise the query string breaks. The same applies to API requests: a value passed in a query parameter has to be percent-encoded so the server parses it as a single value rather than as extra parameters. Tracking links, OAuth redirect URLs, and pre-filled form links all rely on correctly encoded components.
Decoding is the everyday counterpart. When you copy a URL from a browser address bar, an analytics report, or a server log, it is often littered with %20, %3D, and similar sequences that are hard to read. Decoding turns it back into legible text so you can see what the link actually points to. A frequent mistake is double-encoding — encoding a string that was already encoded, which turns %20into %2520. If a decoded URL still shows stray percent sequences, decode it a second time to recover the original.
Frequently Asked Questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a complete URL and leaves characters like /, ?, and & intact. encodeURIComponent encodes a URL component (such as a query value) and also encodes those characters. This tool uses encodeURIComponent to safely encode individual values.
Does this tool send my data to a server?
No. All encoding and decoding runs in your browser via the built-in encodeURIComponent and decodeURIComponent functions. Nothing is transmitted.
Why does decoding fail?
Decoding fails when the input contains a malformed percent sequence — for example, %GG (non-hex digits) or a lone % not followed by two hex digits. Ensure the input is a valid percent-encoded string before decoding.