🔗 URL Encoder/Decoder
Percent-encode or decode URLs
About the URL Encoder and Decoder
URLs can only contain a limited set of safe characters. Letters, numbers, and a handful of symbols like hyphens and underscores are fine as-is, but characters like spaces, ampersands, question marks, and non-ASCII letters need to be encoded before they can travel safely inside a URL. This URL Encoder converts those characters into their percent-encoded equivalents, and the decoder reverses the process.
Percent encoding works by replacing each unsafe character with a percent sign followed by its two-digit hexadecimal ASCII code. A space becomes %20, an ampersand becomes %26, and a forward slash becomes %2F. This encoding standard is defined in RFC 3986 and ensures that URLs can be transmitted and interpreted correctly across every browser, server, and network layer regardless of the character set in use.
Encoding matters in several practical scenarios. When you submit a search query containing special characters, the browser encodes it into the URL. When you build a URL dynamically in JavaScript, using encodeURIComponent prevents characters that have structural meaning in URLs, like the ampersand that separates query parameters, from being misread as part of the URL structure rather than as data values.
Decoding is equally useful. When you receive a URL from an API, a redirect, or a log file, the percent-encoded form can be hard to read. Pasting it into this tool converts %20 back to a space, %2C back to a comma, and %E2%80%99 back to the curly apostrophe it originally was. This makes URLs from analytics tools, tracking parameters, and webhook payloads much easier to audit and debug.
The tool handles both standard percent encoding for general URL components and the stricter form encoding used in query strings, where spaces are sometimes encoded as a plus sign rather than %20. Knowing which convention your target system expects can save time when debugging URL parameter handling in forms or API integrations.
How it works
- Paste or type the text or URL you want to encode into the input field.
- Click Encode to convert unsafe characters into percent-encoded format.
- To decode, paste a percent-encoded URL or string and click Decode.
- The result appears immediately in the output area.
- Copy the output with one click and use it in your application, browser, or API request.
- Switch between encoding modes if your use case involves query strings or form data.
What you'll learn
- Percent encoding replaces unsafe characters with a % sign and a two-digit hex code.
- The standard is defined in RFC 3986 and applies to all URL components.
- Spaces encode to %20 in standard mode and + in form query string mode.
- encodeURIComponent in JavaScript follows the same rules this tool uses.
- Non-ASCII characters like accented letters are encoded as multi-byte UTF-8 sequences.
- Decoding converts percent-encoded strings back to their human-readable originals.
FAQs
- What characters need to be percent-encoded in a URL?
- Any character that is not an unreserved character must be encoded. Unreserved characters are uppercase and lowercase letters, digits, hyphens, underscores, periods, and tildes. Everything else, including spaces, slashes, and non-ASCII letters, requires encoding.
- Why does a space sometimes encode as + instead of %20?
- In HTML form submissions using the application/x-www-form-urlencoded content type, spaces are encoded as + signs in query strings. In standard URL encoding per RFC 3986, spaces are always encoded as %20. The two conventions are context-dependent.
- What is the difference between encodeURI and encodeURIComponent?
- encodeURI is designed for full URLs and leaves structural characters like slashes and question marks unencoded. encodeURIComponent encodes everything except unreserved characters and is designed for encoding individual values within a URL, such as query parameter values.
- Can I decode a partial URL or just the query string portion?
- Yes. The decoder works on any string containing percent-encoded sequences, whether it is a full URL, just a query string, or an individual parameter value. Paste whatever portion you need decoded.
- Why do some URLs contain long sequences like %E2%80%99?
- Non-ASCII characters are encoded as UTF-8 byte sequences, and each byte gets its own percent-encoded value. The curly apostrophe, for example, is a three-byte UTF-8 character, which is why it produces three percent-encoded groups in the URL.