Introduction: What Is a URL Encoder Decoder?
When you click a link or submit a form, your browser and server need to communicate using a strict set of rules. That is where a url encoder decoder becomes essential. URLs can only contain a limited set of safe ASCII characters. When a URL needs to carry spaces, accented letters, special symbols, or non-Latin scripts, those characters must be converted into a format the web can safely transmit.
This conversion is called percent-encoding or URL encoding. It is one of the most fundamental concepts in web development, and understanding it will save you hours of debugging broken links, broken form submissions, and malformed API requests.
In this guide, you will learn what URL encoding is, why it exists, how to read encoded values, how to encode a URL online or decode a URL online in seconds, and how to handle it correctly in JavaScript and Python.
What Is URL Encoding (Percent-Encoding)?
URL encoding replaces unsafe or reserved characters with a percent sign followed by two hexadecimal digits. For example, a space becomes %20 and an ampersand becomes %26.
The standard is defined in RFC 3986. It is also called percent-encoding because every replacement starts with the % character, followed by the two-digit hexadecimal code for that character's byte value in UTF-8.
Why is this necessary? URLs were designed to carry only a subset of ASCII characters. Characters like spaces, quotes, angle brackets, and non-ASCII letters (like German umlauts or accented French vowels) are not safe in a raw URL. Without encoding, these characters can be misinterpreted by servers, proxies, and browsers, causing requests to fail silently or behave unexpectedly.
URL encoding is not encryption. It is a lossless text transformation that any tool can reverse instantly. Never use it to protect sensitive data.
Common Encoded Characters: Quick Reference Table
Here are the most frequently encountered characters and their percent-encoded equivalents. All values below are verified against the UTF-8 standard and RFC 3986:
| Character | Name | Encoded Value | When You See It |
|---|---|---|---|
| (space) | Space | %20 | Search queries, file names with spaces |
| & | Ampersand | %26 | Separating query parameters |
| = | Equals | %3D | Key=value pairs in query strings |
| ? | Question Mark | %3F | Start of query string |
| # | Hash / Fragment | %23 | Fragment identifiers in URLs |
| / | Forward Slash | %2F | Path separators when used as data |
| % | Percent Sign | %25 | When a literal percent is part of data |
Note: Characters A–Z, a–z, 0–9, hyphen, underscore, period, and tilde are considered unreserved and do not need encoding.
3 Worked Encoding Examples
Example 1: Search Query with Spaces and Symbols
Input: hello world & co.
Encoded: hello%20world%20%26%20co.
Each space becomes %20 and the ampersand becomes %26. The period is unreserved and stays as-is.
Example 2: URL as a Query Parameter Value
Imagine you need to pass a redirect URL as a query string value:
Input value: https://example.com/path?page=1&sort=asc
Encoded: https%3A%2F%2Fexample.com%2Fpath%3Fpage%3D1%26sort%3Dasc
The colons, slashes, question mark, equals signs, and ampersand are all encoded because they are part of a value, not URL structure. The final URL might look like:/redirect?to=https%3A%2F%2Fexample.com%2Fpath%3Fpage%3D1%26sort%3Dasc
Example 3: Non-English Character “é” and a Percent Sign
Input: café and 50% off
Encoded: caf%C3%A9 and 50%25%20off
The letter “é” has the UTF-8 byte sequence 0xC3 0xA9, which becomes %C3%A9. A literal percent sign is always encoded as %25 to avoid being misread as the start of an encoded sequence.
How to Decode a URL Online in 3 Steps
You do not need to memorise hex codes or write scripts for everyday encoding and decoding. Our free url encoder decoder handles it instantly:
- Paste your encoded or raw URL into the input field on the URL Encoder Decoder tool.
- Choose Encode or Decode. Use Encode on the URL Encoder Decoder to convert raw text into percent-encoded format. Use Decode to turn
%20,%26, and similar sequences back into human-readable characters. - Copy the result and use it in your browser bar, API request, HTML attribute, or redirect rule immediately.
The tool is free, works in your browser without uploading data to any server, and handles all UTF-8 characters including emojis and non-Latin scripts. If you work with marketing links, also check our UTM builder to generate properly encoded campaign URLs automatically, or use the slug generator to create clean, URL-safe strings from any text.
URL Encoding for Developers: JavaScript and Python
When you need to handle URL encoding programmatically, both JavaScript and Python provide built-in functions. Knowing which one to use in each context is important.
JavaScript: encodeURI vs encodeURIComponent
encodeURIComponent('hello world&lang=fr');
// Result: hello%20world%26lang%3Dfr
// Use encodeURI for a complete URL (keeps :, /, ?, &, = intact)
encodeURI('https://example.com/search?q=hello world');
// Result: https://example.com/search?q=hello%20world
- Use
encodeURIComponentwhen encoding individual values like search terms, redirect URLs, or form field data passed as query parameters. - Use
encodeURIonly when encoding a complete URL that you want to preserve as a valid address. It does not encode reserved characters like:/?&=.
Python: urllib.parse
# Encode a string value
quote('hello world & co.')
# Result: 'hello%20world%20%26%20co.'
# Decode back to plain text
unquote('caf%C3%A9')
# Result: 'café'
By default, quote() does not encode the forward slash /. Pass safe='' to encode it as well: quote(value, safe='').
If you work with binary data or image files alongside URL manipulation, our image Base64 converter handles a related encoding task for embedding images in HTML and CSS. For a broader overview of tools in this category, visit the ultimate guide to online developer tools.
Common Mistakes When Encoding URLs
Even experienced developers run into these three mistakes regularly. Learning to spot them early saves significant debugging time.
1. Double Encoding (%25 instead of %)
Double encoding happens when you encode a string that is already encoded. For example, encoding hello%20world a second time gives you hello%2520world. The %25 is the encoded form of a literal percent sign, so the server sees the word hello%20world as text, not as hello world. Always decode first, then re-encode if needed.
2. Encoding the Entire URL Structure
Using encodeURIComponent on a complete URL converts structural characters like :, /, ?, and & into encoded sequences. The result is an unroutable string. Only encode individual parameter values, not entire URLs, unless your intent is specifically to pass a URL as a data value inside another URL.
3. Confusing + with %20 for Spaces
In HTML form encoding (the application/x-www-form-urlencoded content type), a space is represented as a plus sign +. In standard percent-encoding (RFC 3986), a space is %20. These two formats are not interchangeable. Using + in a path segment or as part of an API parameter (outside of a form submission) will be treated as a literal plus sign, not a space. Use %20 in URL paths and API query values to avoid this ambiguity.
For SEO-related URL tasks, browse our SEO tools category for additional utilities to audit and optimise your site links.
Conclusion
URL encoding is a small detail that makes a huge practical difference. Broken links, failed API calls, and unreadable query parameters are almost always caused by missing or incorrectly applied percent-encoding.
Now that you understand the rules — when to encode, what each percent sequence means, and which function to reach for in JavaScript or Python — you can handle any url encoder decoder task with confidence. Use our free URL Encoder Decoder tool for quick, browser-based conversions whenever you need them.
