URL Encode / Decode
Encode special characters for URLs or decode percent-encoded strings
Client-side processing — your data never leaves your browser
Text Input
Text or URL to encode
Encoded Output
URL-encoded result
What Is URL Encoding?
URL encoding (also called percent-encoding) converts characters that are not allowed in URLs into a format that can be safely transmitted. Characters are replaced with a % sign followed by their two-digit hexadecimal ASCII value. For example, a space becomes %20, and an ampersand becomes %26.
This encoding is defined in RFC 3986 and is essential for constructing valid URLs, especially when query parameters contain spaces, special characters, or non-ASCII characters like accented letters and emoji.
encodeURIComponent vs encodeURI
JavaScript provides two URL encoding functions with different scopes:
encodeURIComponent
Encodes everything except: A-Z a-z 0-9 - _ . ~ ! * ' ( )
Use this for encoding individual query parameter values or path segments. It encodes =, &,/, and ? — which is correct for parameter values but would break a full URL structure.
encodeURI
Preserves URL structural characters: : / ? # [ ] @ ! $ & ' ( ) * + , ; =
Use this for encoding a complete URL while preserving its structure (protocol, host, path, query delimiters). Only non-ASCII characters, spaces, and a few others get encoded.
Common Characters and Their Encodings
| Character | Encoded | Description |
|---|---|---|
| (space) | %20 | Space character |
| ! | %21 | Exclamation mark |
| # | %23 | Hash / fragment identifier |
| & | %26 | Ampersand (query separator) |
| = | %3D | Equals (key=value separator) |
| ? | %3F | Question mark (query start) |
| / | %2F | Forward slash (path separator) |
| @ | %40 | At sign |
| + | %2B | Plus sign |
When to Use URL Encoding
API Query Parameters
When constructing API calls with dynamic values, always encode parameter values to prevent special characters (spaces, ampersands, equals signs) from breaking the URL structure.
Form Submissions
HTML forms with method="GET" automatically URL-encode field values. Understanding encoding helps debug form data in browser dev tools and server logs.
Redirect URLs
OAuth flows and SSO systems pass redirect URLs as query parameters. The redirect URL itself must be encoded so its ? and & don't get confused with the outer URL's delimiters.
Log Analysis
Server logs and analytics platforms show URLs with percent-encoded characters. Decoding them reveals the actual search terms, usernames, or file paths users requested.
Related Tools
How to Use the URL Encoder / Decoder
Choose Encode or Decode
Select the "Encode" tab to percent-encode special characters in a string, or the "Decode" tab to convert a percent-encoded URL back to readable text.
Choose the encoding mode (Encode only)
Use "Encode Component" (encodeURIComponent) to encode a query parameter value — this encodes =, &, /, and ?. Use "Encode URL" (encodeURI) to encode a complete URL while preserving its structural characters.
Paste your input
Enter the text or percent-encoded string in the input textarea on the left.
Click the button and copy
The result appears instantly. Use the Copy button to copy it to your clipboard.
Frequently Asked Questions
What is the difference between encodeURIComponent and encodeURI?▼
encodeURIComponent encodes everything except A-Z a-z 0-9 - _ . ~ ! * '( ), making it safe for query parameter values. encodeURI preserves URL structural characters like : / ? # [ ] @ and is for encoding complete URLs while keeping the structure intact.
What does %20 mean in a URL?▼
%20 is the percent-encoded representation of a space character (ASCII 32, hex 20). When browsers display URLs they sometimes show spaces as + in query strings (application/x-www-form-urlencoded), but RFC 3986 uses %20.
Why does my URL have %2F after encoding?▼
%2F is an encoded forward slash (/). encodeURIComponent encodes slashes because they are path separators in URLs. If you are encoding a path segment that intentionally contains a slash, preserve it by not using encodeURIComponent on the full path.
What characters are safe in a URL without encoding?▼
Unreserved characters that never need encoding: A-Z a-z 0-9 - _ . ~ These can appear anywhere in a URL. All other characters should be percent-encoded when used as data (not as structural delimiters).
Is my data sent to a server?▼
No. All encoding and decoding uses JavaScript's built-in encodeURIComponent, encodeURI, decodeURIComponent, and decodeURI functions — running entirely in your browser.
Further Reading
Built by JDApplications