URL Encoder & Decoder
What Is URL Encoding?
URL encoding (also called percent-encoding) is a mechanism defined in RFC 3986 for representing special characters in a URI (Uniform Resource Identifier). Characters that aren't allowed in URLs — such as spaces, ampersands, non-ASCII characters, and certain punctuation — are replaced with a percent sign % followed by their two-digit hexadecimal value. For example, a space becomes %20, an ampersand becomes %26, and the Euro sign (€) becomes %E2%82%AC.
URL encoding is essential because URLs can only contain a limited set of characters from the ASCII character set. Without encoding, characters like &, =, ?, and # would be interpreted as URL delimiters rather than literal characters, breaking the URL structure.
How to Use This Tool
Select Encode or Decode mode using the tabs. Paste your text or encoded URL into the input field. The tool processes it instantly when "Live update" is enabled. Choose between encodeURIComponent (for individual values) or encodeURI (for complete URLs) using the mode dropdown.
encodeURIComponent vs encodeURI
JavaScript provides two URL encoding functions with different behaviors:
- encodeURIComponent — Encodes everything except:
A-Z a-z 0-9 - _ . ! ~ * ' ( ). Use this for encoding query parameter values, form data, or any text that will be embedded within a URL. This is the recommended choice for most use cases. - encodeURI — Preserves URL structure characters like
: / ? # [ ] @ ! $ & ' ( ) * + , ; =. Use this only when encoding a complete URL while preserving its structure.
Real-World Use Cases
- API Query Parameters — When passing user input as URL parameters, encoding prevents injection attacks and ensures special characters are transmitted correctly.
- Form Data Submission — HTML forms encode field values before sending them. Understanding encoding helps debug form submission issues.
- Redirect URLs — When embedding a URL inside another URL (e.g., OAuth redirect URIs), the inner URL must be encoded to avoid conflicts.
- Internationalized URLs — URLs with non-Latin characters (Chinese, Arabic, Cyrillic) need encoding to work across all browsers and servers.
- Deep Linking — Mobile deep links and app URLs often contain encoded parameters to pass data between applications.
Common URL Encoding Values
%20— Space (also+in form data)%26— Ampersand (&)%3D— Equals sign (=)%3F— Question mark (?)%23— Hash (#)%2F— Forward slash (/)%40— At sign (@)
Frequently Asked Questions
When should I URL encode?
URL encode whenever you're passing user-generated content as URL parameters, including special characters in URIs, constructing API query strings, or building redirect URLs that contain nested URLs.
What is the difference between %20 and +?
Both represent a space. %20 is used in URLs (percent-encoding per RFC 3986), while + is used in HTML form data (application/x-www-form-urlencoded). When in doubt, use %20 as it works in all contexts.
Should I encode the entire URL or just parts of it?
Only encode the parts that contain user data or special characters — typically query parameter values and path segments. Do not encode the entire URL structure (protocol, host, slashes) as this will break the URL.
Why do some characters not need encoding?
The "unreserved characters" defined in RFC 3986 — letters, digits, hyphens, underscores, periods, and tildes — are safe in all parts of a URL and never need encoding. Reserved characters only need encoding when used outside their special meaning.
Is my data safe?
Yes. All encoding and decoding happens in your browser using JavaScript's built-in functions. No data is transmitted to any server.