URL Encoder & Decoder
Quickly encode special characters in a URL or decode a percent-encoded string back into readable text. This tool supports both encodeURI (keeps URL-reserved characters like / and ? as-is) and encodeURIComponent (encodes everything, ideal for individual query parameter values). It's a fast helper for building share links, debugging API requests, or escaping search strings.
What Is URL Encoding?
URL encoding (also called percent-encoding) replaces characters that are unsafe in a URL with a % sign followed by two hexadecimal digits. For example, a space becomes %20, an ampersand becomes %26, and a pound sign becomes %23. This ensures URLs are transmitted correctly across the internet regardless of the browser, OS or server.
encodeURI vs encodeURIComponent — Which Should I Use?
| Function | Encodes | Keeps | Best For |
|---|---|---|---|
encodeURI | Spaces, non-ASCII, most special chars | :/?#[]@!$&'()*+,;= | Full URLs |
encodeURIComponent | Everything above PLUS reserved chars | Letters, digits, -_.!~*'() | Query parameter values |
Rule of thumb: use encodeURIComponent when encoding individual query values (e.g. a search term or API parameter). Use encodeURI only when you have a complete URL that already has a valid structure.
Common Characters and Their Encoded Forms
| Character | Encoded | Character | Encoded |
|---|---|---|---|
| Space | %20 | & | %26 |
= | %3D | + | %2B |
/ | %2F | ? | %3F |
# | %23 | @ | %40 |
When Do You Need URL Encoding?
- Passing a search query with spaces or special characters in a URL.
- Building API request URLs programmatically.
- Encoding form data sent via GET requests.
- Creating share links that include arbitrary user text.
- Debugging URL parsing issues in web applications.
Frequently Asked Questions
What is URL encoding?
URL encoding replaces unsafe characters with %XX sequences so they can be safely included in a URL. For example, a space becomes %20 and an ampersand becomes %26.
When should I use URL encoding?
Whenever you include user input, special characters or non-ASCII text in a URL — such as query strings, form data, or dynamically generated share links.
What's the difference between encodeURI and encodeURIComponent?
encodeURI keeps reserved characters like /, ? and # so it works on full URLs. encodeURIComponent encodes everything — use it for individual query parameter values.
Is the data sent to a server?
No. Encoding and decoding happen entirely in your browser using built-in JavaScript functions. Nothing is transmitted.