URL Encoder & Decoder

Percent-encode special characters in URLs or decode encoded URLs back to plain text. Supports encodeURIComponent and encodeURI modes.

Input Text

Frequently Asked Questions

URL encoding (also called percent-encoding) converts characters that are not safe in URLs into a % followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20 and & becomes %26. This ensures URLs are transmitted correctly over the internet without ambiguity.
encodeURIComponent encodes everything except letters, digits, and - _ . ! ~ * ' ( ) β€” it is designed for encoding a single component (like a query string value). encodeURI also preserves URL-structural characters like : / ? # [ ] @ ! $ & ' ( ) * + , ; = β€” it encodes a whole URL while keeping its structure intact. For encoding a parameter value, always use encodeURIComponent.
Spaces can be encoded as %20 (standard percent-encoding) or + (application/x-www-form-urlencoded format used in HTML form submissions). They are technically different encodings: %20 is correct for path segments and query values in full URLs; + is only valid inside application/x-www-form-urlencoded query strings. Always use %20 (encodeURIComponent) in modern code unless you are specifically targeting form-encoded data.
Reserved characters that have special meaning in URLs (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) must be encoded when used as data. Unsafe characters that must always be encoded include spaces, { } | \ ^ ` < >, and characters outside the ASCII printable range. All other non-ASCII characters (Unicode) must be UTF-8 encoded first, then percent-encoded.
Non-ASCII characters are first encoded as UTF-8 bytes, then each byte is percent-encoded. For example, the emoji πŸ˜€ (U+1F600) encodes to UTF-8 bytes F0 9F 98 80, which becomes %F0%9F%98%80 in a URL. Modern browsers handle this automatically in the address bar, but when constructing URLs in code you must use encodeURIComponent() which handles UTF-8 encoding for you.
Double encoding happens when an already-encoded URL is encoded again β€” %20 becomes %2520 (encoding the % sign). This typically occurs when building URLs from dynamic data that was already encoded, or when passing encoded URLs through multiple encoding layers. Always encode data values before adding them to a URL, and decode once on receipt. Never encode an entire URL that already contains valid percent-encoding.
Use decodeURIComponent to decode a single URL component (a query value, path segment). Use decodeURI to decode a whole URL while preserving the characters that have structural meaning (: / ? # @ etc.). In most API and form-handling code, you will use decodeURIComponent. This tool's decoder uses decodeURIComponent for maximum compatibility.
URL encoding is not a security control against SQL injection or XSS β€” it is for making data safe for transmission in URLs, not for making data safe for insertion into SQL queries or HTML. For SQL injection prevention, use parameterized queries. For XSS prevention, use context-appropriate output encoding (HTML entity encoding for HTML contexts, JSON encoding for script contexts). URL-encoding user input before putting it in a URL is correct for URL safety, but is a separate concern from SQL and HTML safety.
The HTTP specification does not set a maximum URL length, but practical limits exist. Most browsers support URLs up to 64,000–100,000 characters. Web servers (Apache, Nginx) typically allow 4,000–8,000 characters by default. The Internet Explorer limit was 2,083 characters, which became an informal standard. When URL-encoding large amounts of data as query parameters, consider switching to a POST request with a JSON body instead of a GET request.
The "URI malformed" error occurs when decodeURIComponent encounters invalid percent-encoding sequences β€” such as a lone % not followed by two hex digits, or incomplete multibyte UTF-8 sequences. This can happen with truncated data, incorrect manual encoding, or content that contains literal percent signs that weren't meant as encoding markers. Ensure the input is a well-formed percent-encoded string before decoding.

About This URL Encoder / Decoder

This free URL encoder and decoder converts text to percent-encoded URL format and back. All processing happens in your browser. Supports both encodeURIComponent (for query parameter values) and encodeURI (for full URLs).

When to use this tool

  • Encoding query string values with special characters
  • Decoding percent-encoded URLs from logs or redirects
  • Debugging URL encoding issues in API integrations
  • Understanding how non-ASCII characters appear in URLs

Related Articles

In-depth guides and technical articles.

View all →
Why OAuth redirect_uri Errors Are Almost Always Encoding Problems β€” and How to Fix Them
OAuth redirect_uri errors are almost always URL encoding mismatches β€” the encoded URI sent in the authorization request must exactly match the registered URI, character for character. Here's the correct encoding for redirect_uri, why Base64 state parameters break CSRF checks when + decodes as space, the five different array encoding formats that different frameworks use, and the URL parser inconsistencies that enable SSRF attacks.
URL Encoding Context: Why a URL Inside Another URL, in HTML, and in a Shell Command All Need Different Treatment
A URL that works in a browser can fail in curl, JSON, or as a query parameter β€” because each context has different rules about which characters need encoding. Here's why "just URL-encode it" is underspecified without knowing the context, the encoding-within-encoding problem (a URL as a value inside another URL), why & needs HTML entity encoding in href attributes but not JSON, and the + vs %20 space ambiguity.
URL Design as API Design: REST Conventions, Versioning Strategies, and the Long-Term Cost of Changing URLs
REST URL conventions, API versioning strategies (URL path vs header vs date-based like Stripe), trailing slash canonicalization, URL length limits, and the link rot problem β€” URL design decisions made at launch determine API maintainability for years.
URL Structure: Query String Parsing Ambiguities, Punycode, and Open Redirect Vulnerabilities
A URL has five components β€” and bugs come from confusing which part you're encoding. Here's query string parsing ambiguities between frameworks, IDN Punycode for international domains, URL normalisation for comparison, open redirect vulnerabilities, and relative URL resolution edge cases.
URL Encoding Edge Cases That Break Real Applications
The difference between encoding a full URL and a URL component, why + and %20 aren't always interchangeable, how double-encoding silently corrupts data, and the characters that break most URL handling code.