URL Encoder/Decoder
Encode and decode URLs with query string builder
Input
Output
🔧 Query String Builder
📖 URL Encoding
URL encoding converts characters into a format that can be transmitted over the Internet. Special characters are replaced with % followed by hex values.
- • Space → %20 (+ means a space only in form-encoded query strings; this tool outputs %20 and leaves + unchanged when decoding)
- • & → %26
- • = → %3D
- • ? → %3F
💡 Use Cases
- • Building API request URLs
- • Encoding query parameters
- • Sharing URLs with special characters
- • Form data submission
- • Debugging URL issues
- • SEO-friendly URLs
Overview
The URL Encoder/Decoder converts text to and from percent-encoding, the format used to put spaces, symbols and non-English characters safely into a URL. It also includes a Query String Builder that turns a list of keys and values into a correctly encoded query string such as q=red%20shoes&page=2.
Percent-encoding, defined in RFC 3986, replaces each unsafe character with a % sign followed by two hexadecimal digits for each of its UTF-8 bytes. A space becomes %20, & becomes %26, and é becomes %C3%A9. This page uses JavaScript's encodeURIComponent and decodeURIComponent, which encode everything except letters, digits and the characters - _ . ! ~ * ' ( ).
Because encodeURIComponent is designed for individual parts of a URL, it also encodes :, / and ?. Use it on query values, path segments and parameters rather than on a complete address, or the URL's own structure will be encoded too.
How to Use
- Choose Encode or Decode with the buttons at the top.
- Type or paste your text into the Input box. The result appears instantly in the Output box; click Load Sample to see an example.
- Click Swap to move the output into the input and switch modes, which is useful for checking that a value decodes back to the original.
- To build a query string, enter a Key and Value in the Query String Builder, click Add Parameter for more rows, then click Build Query String. Rows with an empty key are skipped.
- Click the copy icon above the Output box to copy the result.
Frequently Asked Questions
What is URL encoding and why is it needed?
URLs may only contain a limited set of ASCII characters, and some characters such as ?, & and = have special meaning in a URL. URL encoding, or percent-encoding, replaces other characters with a percent sign and their byte values in hexadecimal so the URL is transmitted correctly and parsed the way you intend. Without it, a search for "fish & chips" would be split at the ampersand.
How do I encode a space in a URL: %20 or +?
Both are seen. %20 is the standard percent-encoding for a space and works anywhere in a URL. The plus sign means a space only in query strings using the HTML form format (application/x-www-form-urlencoded). This tool always produces %20, and when decoding it leaves + as a literal plus sign, so replace + with spaces first if you are decoding form-submitted data.
What does "hello world & café" look like URL-encoded?
Encoding it here gives hello%20world%20%26%20caf%C3%A9. Each space becomes %20, the ampersand becomes %26, and the é, which is two bytes in UTF-8, becomes %C3%A9. Letters and digits stay unchanged. Switching to Decode, or clicking Swap, turns the encoded text back into the original phrase exactly.
Why does encoding a full URL turn :// into %3A%2F%2F?
This tool uses encodeURIComponent, which is meant for a single component such as a query value, so it encodes reserved characters including :, /, ? and &. That is what you want when a URL is passed as a parameter inside another URL, for example a redirect link. To make a full address safe, encode only the parts that need it, such as each query value, and leave the scheme, host and separators as they are.
Why do I get an "Invalid percent-encoding" error when decoding?
Decoding fails if the input contains a % that is not followed by two hexadecimal digits, such as "50% off", or a sequence of bytes that is not valid UTF-8, such as %E9 on its own. Text that was never encoded can trigger this. Encode a literal percent sign as %25, and check that the text was encoded as UTF-8 rather than an older character set.
How does the Query String Builder work?
It takes each row with a non-empty key, encodes the key and value separately with encodeURIComponent, joins each pair with = and joins pairs with &. For example, the key q with value red shoes and the key page with value 2 produce q=red%20shoes&page=2. Add a ? in front and append it to your base URL. A key with an empty value is kept as key=.