Advertisement

URL Encoder / Decoder

Encode or decode URLs and URI components. Handle special characters safely.

0 characters

0 characters

Encoding Mode Comparison

encodeURIComponent
  • Encodes all special characters
  • Best for query parameter values
  • hello world → hello%20world
  • a=1&b=2 → a%3D1%26b%3D2
encodeURI
  • Preserves URL structure characters
  • Best for encoding full URLs
  • Keeps :, /, ?, #, & intact
  • Only encodes spaces and non-ASCII
Advertisement

Related Tools

Advertisement

Frequently Asked Questions

What is URL encoding?
URL encoding (also called percent-encoding) replaces unsafe or reserved characters in a URL with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII or UTF-8 byte value. For example, a space becomes %20 and an ampersand becomes %26. This ensures URLs are transmitted correctly across the internet without ambiguity.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URI but preserves characters that have special meaning in URLs such as ://?#[]@!$&'()*+,;=. encodeURIComponent encodes everything except unreserved characters (A-Z, a-z, 0-9, -, _, ., ~), making it suitable for encoding individual query parameter values where reserved characters must also be escaped.
Why do I need to encode URLs?
URLs can only contain a limited set of ASCII characters as defined by RFC 3986. If your URL includes spaces, non-ASCII characters (like accented letters or emoji), or reserved characters like & or = that have special meaning in URLs, they must be encoded so browsers and servers can interpret them correctly without confusion.
What characters need to be URL encoded?
Characters that must be encoded include spaces (becomes %20 or +), reserved characters (& = + # ? / : @ ! $ ' ( ) * , ;), unsafe characters (< > { } | \ ^ ~ [ ] `), and any non-ASCII characters including accented letters, Chinese characters, emoji, and other Unicode. Only unreserved characters (A-Z, a-z, 0-9, -, _, ., ~) can appear in URLs without encoding.
What is the difference between %20 and + for spaces?
Both represent spaces in URLs, but they are used in different contexts. %20 is the standard percent-encoding for spaces in the path and general URL components as defined by RFC 3986. The + sign represents spaces only in the application/x-www-form-urlencoded format used by HTML form submissions and query strings. Most modern APIs and frameworks accept both, but %20 is the more universal and standards-compliant choice.
How does URL encoding handle Unicode and international characters?
Unicode characters are first encoded as UTF-8 bytes, then each byte is percent-encoded. For example, the euro sign (€) has the UTF-8 encoding 0xE2 0x82 0xAC, which becomes %E2%82%AC in a URL. This allows URLs to safely contain characters from any language while remaining compatible with ASCII-based internet protocols.
Can I decode a URL that was encoded multiple times?
Yes, our tool can decode URLs that have been double-encoded or triple-encoded. Double encoding happens when an already-encoded URL is encoded again, turning %20 into %2520. You may need to run the decode operation multiple times to fully decode such URLs. This commonly occurs when URLs pass through multiple systems that each apply their own encoding.
Is this tool safe for encoding sensitive data?
Yes, all encoding and decoding happens entirely in your browser using JavaScript's built-in encodeURIComponent and decodeURIComponent functions. No data is ever sent to a server. Your URLs, query parameters, and any sensitive information you process remain completely private on your device.

How to Use the URL Encoder/Decoder

Encoding and decoding URLs is essential when working with web APIs, query strings, or any system that transmits data through URLs. Our tool makes the process instant and error-free.

Step 1: Paste your input. Enter the text you want to encode or the encoded URL you want to decode into the input field. You can paste full URLs, individual query parameter values, file paths, or any text containing special characters that need encoding.

Step 2: Choose your operation. Select whether you want to encode or decode. Encoding converts special characters to their percent-encoded equivalents (for example, spaces become %20). Decoding reverses the process, converting percent-encoded sequences back to their original characters.

Step 3: Copy the result. The encoded or decoded output appears instantly as you type or paste. Click the copy button to copy the result to your clipboard, ready to use in your code, API request, or browser address bar.

Handling special cases. For query parameter values, use full component encoding (equivalent to JavaScript's encodeURIComponent) which encodes all characters except A-Z, a-z, 0-9, and - _ . ~. For complete URLs where you want to preserve the structure (protocol, slashes, colons), use URI encoding (equivalent to encodeURI) which leaves URL-structural characters intact.

Pro tip: If you encounter a URL that appears garbled with sequences like %2520, it has likely been double-encoded. Run the decode operation twice to fully restore the original text.

What Is URL Encoding?

URL encoding, formally known as percent-encoding, is a mechanism defined by RFC 3986 for encoding information in a Uniform Resource Identifier (URI). URLs are restricted to a specific set of ASCII characters, so any character outside this set must be represented using a special encoding scheme.

The encoding process converts each unsafe character into one or more sequences consisting of a percent sign (%) followed by two hexadecimal digits representing the character's byte value. For ASCII characters, this is straightforward: a space (byte value 0x20) becomes %20, an ampersand (0x26) becomes %26, and an equals sign (0x3D) becomes %3D. For Unicode characters, the text is first encoded as UTF-8 bytes, then each byte is individually percent-encoded.

RFC 3986 defines three categories of characters for URL purposes. Unreserved characters (A-Z, a-z, 0-9, hyphen, underscore, period, tilde) can appear in any part of a URL without encoding. Reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) have special meaning in URL syntax and must be encoded when used as data rather than as delimiters. All other characters, including spaces and non-ASCII characters, must always be encoded.

Understanding URL encoding is critical for web development because incorrect encoding causes broken links, failed API calls, security vulnerabilities (like injection attacks), and data corruption. Many subtle bugs in web applications stem from improper handling of URL encoding, especially when dealing with user-generated content, international characters, or data that passes through multiple systems.

URL Encoder/Decoder Use Cases

Query string parameters. When building URLs with query parameters, each parameter value must be properly encoded. If a search term contains spaces, ampersands, or other special characters, failing to encode them will break the URL structure. For example, searching for "Tom & Jerry" requires encoding the ampersand as %26 so the server does not interpret it as a parameter separator.

API development and testing. REST APIs frequently require URL-encoded parameters in requests. When constructing API calls manually or debugging failed requests, you need to quickly encode parameter values or decode URLs from server logs to understand what data was actually transmitted. This is especially common when working with OAuth callbacks, webhook URLs, and redirect chains.

Redirect URLs and deep links. When passing a URL as a parameter to another URL (common in OAuth flows, email tracking links, and authentication redirects), the inner URL must be fully encoded to prevent its special characters from being interpreted as part of the outer URL. For instance, a redirect parameter like redirect=https://example.com/page?id=5 must be encoded to redirect=https%3A%2F%2Fexample.com%2Fpage%3Fid%3D5.

International content and Unicode. Web applications that handle content in multiple languages need proper URL encoding for internationalized resource identifiers (IRIs). Japanese, Chinese, Arabic, Cyrillic, and other non-Latin characters must be UTF-8 encoded and then percent-encoded to create valid URLs that work across all browsers and servers.

Debugging and troubleshooting. When diagnosing web application issues, you often encounter encoded URLs in server logs, error messages, and network traces. Quickly decoding these URLs reveals the actual parameters and values being transmitted, speeding up the debugging process significantly. Double-encoded URLs are a particularly common source of bugs that this tool helps identify.

Why Use Our URL Encoder/Decoder?

Instant, real-time results. Encoding and decoding happens as you type, with no need to click a submit button or wait for processing. This makes it fast to iterate when you are constructing complex URLs with multiple parameters or debugging encoded strings from logs.

Full Unicode support. Our tool correctly handles all Unicode characters including emoji, CJK characters, Arabic script, accented letters, and mathematical symbols. The encoding follows the RFC 3986 standard with proper UTF-8 byte encoding, ensuring compatibility with all modern browsers and web servers.

Browser-based and completely private. All encoding and decoding is performed locally in your browser using JavaScript's native encodeURIComponent and decodeURIComponent functions. No data is transmitted to any server. This is especially important when working with URLs that contain API keys, authentication tokens, or other sensitive information.

No signup, no limits, no cost. Use the tool as many times as you need without creating an account or paying anything. Whether you are a student learning about URL encoding, a developer debugging an API integration, or a QA engineer testing internationalization, the tool is always available and ready to use.

Standards compliant. The encoding follows RFC 3986 and uses the same algorithms as JavaScript's built-in encoding functions, ensuring that the output is compatible with every modern web framework, browser, and HTTP library. You can trust that the encoded output will be correctly interpreted by any standards-compliant system.

Advertisement