URL Encoder / Decoder
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.
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.
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
- 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.
- Enter your input: Paste the URL or text you want to convert into the input field at the top of the tool.
- Click Convert: The tool instantly processes your input using the appropriate encoding function and displays the result in the output field.
- Inspect the output: Verify that all special characters have been correctly converted to percent sequences or restored to readable form.
- Copy the result: Press the Copy Output button to place the converted string on your clipboard for use in your code or browser.
- 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.
- Clear to start over: Click the Clear button to empty both fields and begin a fresh conversion without manual deletion.