encoding
URL Encoder / Decoder
Encode or decode URLs and query string components using percent-encoding (RFC 3986).
URL Encoder / Decoder
Encode or decode URLs and query string components using percent-encoding (RFC 3986).
What is this?
Percent-encoding (also called URL encoding) is a mechanism defined in RFC 3986 for representing characters that are not allowed or have special meaning in a URL. Every character that needs encoding is replaced by a percent sign followed by two hex digits representing the character's UTF-8 byte value — for example, a space becomes %20 and an ampersand becomes %26. There are two encoding variants: component encoding (encodeURIComponent) converts every character except the unreserved set A–Z a–z 0–9 and - _ . ! ~ * ' ( ); full URL encoding (encodeURI) additionally preserves the structural characters : / ? # [ ] @ ! $ & ' ( ) * + , ; = so that a complete URL remains navigable. Decoding reverses the process, converting all %XX sequences back to the original characters. URL encoding is required whenever you embed user-supplied text in a query string, form a redirect URL, construct a OAuth callback, or pass data through a system that only allows safe ASCII characters.
How to use
- Paste your text or URL: For query parameter values (names, search terms, user input), paste the raw text and choose 'encode-component'. For a complete URL with a path and query string, paste the full URL and choose 'encode-full'. For decoding, paste any percent-encoded string.
- Choose the mode: encode-component is correct for individual parameter values — it encodes & = ? and other structural characters. encode-full is for complete URLs where you want spaces encoded but the URL structure preserved. decode reverses any percent-encoding.
- Copy the result: The encoded or decoded string appears instantly. The encoding table shows exactly which characters were changed and their %XX codes — useful for debugging encoding issues in APIs or redirect URLs.
FAQ
- What is the difference between encodeURI and encodeURIComponent?
- encodeURI is designed for complete URLs — it leaves the structural characters (: / ? # & = + @) untouched so the URL remains valid. encodeURIComponent is designed for individual values within a URL — it encodes those structural characters too, preventing them from being misinterpreted as URL delimiters. Use encodeURIComponent for query parameter values; use encodeURI only if you have a full URL that you want to sanitise without breaking its structure.
- Why does a space sometimes appear as + instead of %20?
- HTML forms using application/x-www-form-urlencoded encoding replace spaces with + rather than %20. Both are valid in query strings, but they are different encodings. Modern APIs and URLs use %20 (RFC 3986). If you are constructing a query string for a form submission, check whether the receiving server expects + or %20.
- Is my data sent to a server when I encode or decode?
- No. Encoding and decoding run entirely in your browser using built-in JavaScript functions — no network request is made. The REST API endpoint is stateless and logs nothing.
What is URL Encoder / Decoder?
Percent-encoding (also called URL encoding) is a mechanism defined in RFC 3986 for representing characters that are not allowed or have special meaning in a URL. Every character that needs encoding is replaced by a percent sign followed by two hex digits representing the character's UTF-8 byte value — for example, a space becomes %20 and an ampersand becomes %26. There are two encoding variants: component encoding (encodeURIComponent) converts every character except the unreserved set A–Z a–z 0–9 and - _ . ! ~ * ' ( ); full URL encoding (encodeURI) additionally preserves the structural characters : / ? # [ ] @ ! $ & ' ( ) * + , ; = so that a complete URL remains navigable. Decoding reverses the process, converting all %XX sequences back to the original characters. URL encoding is required whenever you embed user-supplied text in a query string, form a redirect URL, construct a OAuth callback, or pass data through a system that only allows safe ASCII characters.
How to use URL Encoder / Decoder
- Paste your text or URL: For query parameter values (names, search terms, user input), paste the raw text and choose 'encode-component'. For a complete URL with a path and query string, paste the full URL and choose 'encode-full'. For decoding, paste any percent-encoded string.
- Choose the mode: encode-component is correct for individual parameter values — it encodes & = ? and other structural characters. encode-full is for complete URLs where you want spaces encoded but the URL structure preserved. decode reverses any percent-encoding.
- Copy the result: The encoded or decoded string appears instantly. The encoding table shows exactly which characters were changed and their %XX codes — useful for debugging encoding issues in APIs or redirect URLs.
Frequently asked questions
- What is the difference between encodeURI and encodeURIComponent?
- encodeURI is designed for complete URLs — it leaves the structural characters (: / ? # & = + @) untouched so the URL remains valid. encodeURIComponent is designed for individual values within a URL — it encodes those structural characters too, preventing them from being misinterpreted as URL delimiters. Use encodeURIComponent for query parameter values; use encodeURI only if you have a full URL that you want to sanitise without breaking its structure.
- Why does a space sometimes appear as + instead of %20?
- HTML forms using application/x-www-form-urlencoded encoding replace spaces with + rather than %20. Both are valid in query strings, but they are different encodings. Modern APIs and URLs use %20 (RFC 3986). If you are constructing a query string for a form submission, check whether the receiving server expects + or %20.
- Is my data sent to a server when I encode or decode?
- No. Encoding and decoding run entirely in your browser using built-in JavaScript functions — no network request is made. The REST API endpoint is stateless and logs nothing.