36+ Free Online Tools | No Registration Required About | Contact | Learning Hub | FAQ | Blog

URL Encoder / Decoder

Web Tools Updated 2025 100% Private

Encode URLs and query parameters into safe percent-encoding or decode them back to readable text. Handles Unicode, emoji, and reserved characters in full compliance with RFC 3986, with instant conversion and one-click copy.

URL Encoder / Decoder

What is a URL Encoder / Decoder?

A URL encoder and decoder is a utility that translates between plain text and the percent encoded form required by the URL specification defined in RFC 3986. URLs may only contain a limited set of unreserved characters, namely the letters, digits, hyphen, period, underscore, and tilde. Any other character, including spaces, punctuation, and non-ASCII symbols, must be replaced with a percent sign followed by two hexadecimal digits representing the byte value of that character in UTF-8.

Reserved characters such as slash, question mark, hash, ampersand, equals, and colon have structural meaning inside a URL. A slash separates path segments, a question mark begins the query string, and an ampersand links multiple parameters together. When these characters appear as literal data, for example inside a search query, they must be percent encoded so the receiving server does not misinterpret them as URL syntax. Failing to do so can corrupt the request, leak parameters, or even expose security vulnerabilities such as HTTP parameter pollution.

Encoding is essential whenever a URL contains user supplied text. Search engines, REST APIs, affiliate tracking systems, and OAuth callback URLs all rely on accurate percent encoding to preserve data integrity. A typical search URL such as example.com/search?q=hello world must encode the space as percent 20, otherwise the browser may truncate the request at the space or interpret the remainder as a separate argument. Similarly, embedding an email address or arbitrary JSON payload in a query parameter requires encoding to ensure special characters survive transport intact.

Decoding reverses this process, converting percent encoded sequences back into their original characters. Web servers perform this automatically before handing the data to your application code, but developers frequently need to manually decode URLs when inspecting logs, debugging API calls, or reverse engineering third party links. This tool handles both directions entirely in your browser, with full support for Unicode characters and emoji that require multi byte UTF-8 encoding.

How URL Encoding Works

The encoder scans the input string character by character. Characters in the unreserved set pass through unchanged. Every other character is converted to its UTF-8 byte representation, and each byte is written as a percent sign followed by two uppercase hexadecimal digits. Decoding scans for percent sequences, converts the hex pairs back to bytes, and reassembles the original UTF-8 text.

Encoding Rule (RFC 3986) Unsafe character → UTF-8 bytes → %XX per byte (uppercase hex)

The two JavaScript functions used by this tool serve different purposes. encodeURIComponent encodes every reserved character and is intended for individual query parameter values. encodeURI preserves URL structural characters and is meant for encoding a complete URL that already has the correct structure but contains unsafe characters in the path or query.

Worked Example

Input: https://example.com/search?q=hello world&lang=en

After encodeURI: https://example.com/search?q=hello%20world&lang=en

After encodeURIComponent: https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den

Decoded back: https://example.com/search?q=hello world&lang=en

Notice how encodeURI preserves the colons, slashes, question mark, and ampersand so the URL remains navigable, while encodeURIComponent escapes every reserved character to make the entire string safe to embed as a single parameter value inside another URL.

How to Use This URL Encoder / Decoder

  1. Select the mode: Choose Encode for a complete URL, Encode Component for a single parameter value, or Decode to convert percent encoded text back to plain text.
  2. Enter your input: Paste the URL or text you want to convert into the input field at the top of the tool.
  3. Click Convert: The tool instantly processes your input using the appropriate encoding function and displays the result in the output field.
  4. Inspect the output: Verify that all special characters have been correctly converted to percent sequences or restored to readable form.
  5. Copy the result: Press the Copy Output button to place the converted string on your clipboard for use in your code or browser.
  6. Swap if needed: Use the Swap button to move the output back into the input field and toggle the mode for quick round trip verification.
  7. Clear to start over: Click the Clear button to empty both fields and begin a fresh conversion without manual deletion.

URL Encoding Best Practices

Encode Each Parameter Separately
When building query strings, encode each parameter name and value individually with encodeURIComponent, then join them with equals and ampersand. Encoding the entire URL at once can break its structure and cause subtle request failures in production.
Never Double Encode
Encoding an already encoded string converts percent signs into percent 25 sequences, corrupting the URL. Always check whether your input is already encoded before applying another round, and decode first if you need to modify the original text.
Use UTF-8 Everywhere
Modern web standards expect URLs to use UTF-8 byte sequences for non-ASCII characters. Avoid legacy encodings such as Latin1 or Shift-JIS in URLs, since they can produce different percent sequences across servers and break interoperability with APIs.
Validate After Decoding
Always validate decoded input on the server side before using it in queries or templates. Decoding reveals the original characters, which may include path traversal attempts, script tags, or SQL injection payloads that must be sanitized before use.

URL Encoder / Decoder FAQs

What is URL encoding and why is it necessary?
URL encoding, also called percent encoding, replaces unsafe or reserved characters in a URL with a percent sign followed by two hexadecimal digits. This ensures that special characters such as spaces, ampersands, and non-ASCII symbols can be transmitted through web browsers, servers, and proxies without being misinterpreted as part of the URL structure itself.
Which characters need to be encoded in a URL?
Characters outside the unreserved set of letters, digits, hyphen, period, underscore, and tilde should be encoded. Reserved characters such as slash, question mark, ampersand, equals, and hash have special meaning in URLs and must be encoded when used as data. Spaces become percent 20 or plus signs, and non-ASCII characters use UTF-8 byte sequences prefixed with percent.
What is the difference between encodeURI and encodeURIComponent?
encodeURI preserves characters that are part of a complete URL structure such as slashes, colons, and question marks, making it suitable for encoding an entire URL. encodeURIComponent encodes every reserved character and is intended for individual query parameter values. Using the wrong one can break links or expose your application to injection issues.
Why do spaces appear as percent 20 or plus signs?
In standard URL encoding, a space becomes percent 20. In application/x-www-form-urlencoded data, such as HTML form submissions, spaces are replaced with plus signs. Both are valid in different contexts. This tool uses percent 20 for general URL encoding, which works correctly in modern browsers, APIs, and most server-side frameworks.
Can URL encoding handle Unicode and emoji characters?
Yes. Modern URL encoding converts Unicode characters to their UTF-8 byte representation, then percent encodes each byte. For example, the smiling emoji becomes a sequence of four percent encoded byte pairs. This allows internationalized domain names, multilingual query parameters, and emoji to be safely transmitted through any standards-compliant web infrastructure.
Is URL encoding the same as HTML entity encoding?
No, they serve different purposes. URL encoding prepares text for safe inclusion in a URL using percent signs and hex digits. HTML entity encoding prepares text for safe display inside HTML using ampersand sequences such as ampersand lt semicolon. Always use the correct encoding for your context to prevent broken links and cross site scripting vulnerabilities.