—
What Is URL Encoding?
URL encoding, formally called percent-encoding, is the process of converting characters that are not allowed or have special meaning in a URL into a safe representation. Each unsafe character is replaced with a % sign followed by two hexadecimal digits — for example, a space becomes %20, an ampersand becomes %26, and a hash becomes %23. This ensures that special characters inside query strings or path segments do not break the URL structure.
RFC 3986 defines the authoritative standard for URL encoding. It divides characters into unreserved (A–Z, a–z, 0–9, -, _, ., ~) which never need encoding, and everything else which must be percent-encoded when used inside a component like a query parameter value. A competing standard — application/x-www-form-urlencoded — is used by HTML forms and some APIs; it encodes spaces as + instead of %20. Using the wrong standard is one of the most common causes of API decoding errors.
Encode or Decode URLs in Seconds
Paste your input
Enter a raw URL, a query string, a path segment, or a percent-encoded value into the input field.
Choose mode & standard
Select Encode, Decode, or Auto (auto-detects which is needed). Pick the encoding standard: RFC 3986, form-urlencoded, encodeURI, or encodeURIComponent.
Get instant output
The result updates live as you type. Copy the encoded or decoded value, or paste a full URL to open the query parameter editor.
Edit & rebuild
Use the parsed URL view to add, remove, or edit query parameters individually, then copy the rebuilt URL — no manual string manipulation needed.
When Developers URL-Encode
Query parameter encoding
Encode values that contain &, =, +, or spaces before appending them to a URL so they do not break the query string structure.
OAuth redirects
Percent-encode the redirect_uri parameter in OAuth flows — many providers reject requests where the URI is not correctly encoded.
Form POST data
Encode form field values in application/x-www-form-urlencoded format before submitting to APIs that expect form-encoded bodies.
API request signing
Many APIs (AWS Signature V4, HMAC-based auth) require query parameters to be canonically percent-encoded before hashing.
Cookie values
Encode special characters in cookie values to prevent them from being misinterpreted by browsers or servers during Set-Cookie / Cookie parsing.
Path segments
Encode file names or user-generated slugs used in URL paths so characters like spaces, #, or ? do not break routing.
URL Encoding Reference — Special Characters
Common characters that must be percent-encoded when used inside a URL component such as a query parameter value or path segment.
| Character | Encoded (RFC 3986) | Notes |
|---|---|---|
| space | %20 | Form-encoded standard uses + instead |
| & | %26 | Parameter separator — must be encoded inside values |
| = | %3D | Key/value delimiter — encode when it appears in a value |
| + | %2B | Encodes to %2B in RFC 3986; represents space in form-encoded |
| / | %2F | Path separator — encode in query values with encodeURIComponent |
| ? | %3F | Query start character — encode inside query values |
| # | %23 | Fragment identifier — encode to prevent truncation of query string |
| @ | %40 | User-info delimiter — encode when used inside a path or query value |
Frequently Asked Questions
1What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a complete URL. It leaves structural characters like /, ?, #, and & untouched because they have meaning in the URL structure. encodeURIComponent encodes a single value to be embedded inside a URL — it encodes everything including /, ?, #, and & so they cannot break the surrounding URL. Use encodeURIComponent for each query parameter value when building a URL programmatically.2When should I use + instead of %20 for spaces?
+ for spaces only when building application/x-www-form-urlencoded content — the format used by HTML form submissions and some REST APIs. For standard RFC 3986 URLs (used everywhere else), encode spaces as %20. Using + in a path segment or an API that expects RFC 3986 will cause the server to receive a literal + character instead of a space.3Is percent-encoding the same as Base64 encoding?
%XX hex sequences so they are safe inside a URL. Base64 converts arbitrary binary data into a printable ASCII string using a 64-character alphabet. If you need to embed a Base64 value in a URL, you should also percent-encode its +, /, and = characters (or use the Base64URL variant which replaces them with -, _, and no padding).4Which characters are safe in a URL without encoding?
- _ . ~. Every other character — including spaces, &, =, +, /, ?, #, @, and non-ASCII Unicode — must be percent-encoded when placed inside a URL component like a query parameter value or path segment.5How do I decode a URL that has been double-encoded?
% character itself becomes %25, so a space that was encoded as %20 becomes %2520 after a second pass. Paste the double-encoded string into this tool — it detects double encoding automatically and decodes back to the original value. You can also use Decode mode manually and apply it twice to step through the layers.6What is URL encoding (percent encoding)?
%XX hexadecimal representation. For example, a space becomes %20, an ampersand becomes %26, and a hash becomes %23. This ensures that special characters inside query strings or path segments do not break the URL structure.7When should I use encodeURIComponent vs encodeURI in JavaScript?
encodeURIComponent when encoding individual query parameter values or path segments — it encodes all reserved characters including /, ?, #, and &. Use encodeURI only when encoding a complete URL that already has its structure intact, because it leaves structural characters unencoded. In practice, encodeURIComponent is the right choice for almost all API development scenarios.8How do I URL encode a space — %20 or +?
%20. The application/x-www-form-urlencoded format (used by HTML form submissions) encodes spaces as +. If you are building a REST API URL or query string programmatically, use %20. If you are submitting an HTML form, the browser handles it automatically.9How do I URL encode a string in JavaScript?
encodeURIComponent(str) to encode a string for use as a query parameter value. To decode, use decodeURIComponent(encoded). Never use the deprecated escape() or unescape() functions — they do not handle Unicode correctly and are removed from modern JavaScript standards.10How do I URL encode in Python?
urllib.parse.quote(s) to encode a string. By default it leaves / unencoded; pass safe="" to encode everything. For encoding a dictionary of query parameters, use urllib.parse.urlencode({"key": "value with spaces"}).11How do I URL encode in curl?
--data-urlencode flag: curl -G "https://api.example.com/search" --data-urlencode "q=hello world". The -G flag sends the data as query parameters. You can also pre-encode values with a shell command like python3 -c "import urllib.parse; print(urllib.parse.quote('hello world'))".12What characters must be percent encoded in a URL?
- _ . ~) must be percent-encoded when used inside a URL component. Key examples: space → %20, & → %26, = → %3D, / → %2F, ? → %3F, # → %23. Non-ASCII characters must first be UTF-8 encoded and then each byte percent-encoded.Developer Guides
Feedback for url_encoder
Tell us what's working, what's broken, or what you wish we built next — it directly shapes our roadmap.
Good feedback is gold — a rough edge you hit today could be smoother for everyone tomorrow.
- Feature ideas often jump the queue when lots of you ask.
- Bug reports with steps get fixed faster — paste URLs or examples if you can.
- Name and email are optional; we won't use them for anything except replying if needed.
Stay Updated
Get the latest tool updates, new features, and developer tips delivered to your inbox.
- Product updates & new tools
- JSON, API & developer tips
- Unsubscribe anytime — no hassle