URL Encode String Tool – Encode and Decode URLs
Enter text or a URL, choose a mode, then click Encode or Decode to view the percent‑encoded output. The tool is local and free; copy the result with the button.
Runs in your browser. Nothing you enter is uploaded.
| Space | %20 (or + in form) |
|---|---|
| & | %26 |
| = | %3D |
| ? | %3F |
| / | %2F |
| # | %23 |
How to use the URL encoder / decoder
- In the
Text or URLtextarea, type the text you want to encode or paste a full URL. - From the
Modedropdown, selectComponent,URI, orForm (application/x-www-form-urlencoded)depending on how the string will be used. - Click the
Encodebutton to convert the input; clickDecodeto reverse the process. The result appears in theOutputtextarea. - If you wish to use the output as new input, press the
Swapbutton to move the result back into theText or URLfield. - Press the
Copybutton beside the output to copy the encoded or decoded string to your clipboard for use elsewhere.
What is percent‑encoding and why use it in URLs?
Percent‑encoding replaces unsafe characters with a percent sign followed by two hexadecimal digits. The encoding is mandatory for characters that have special meaning in URLs, such as spaces, ampersands, or slashes. In component mode the tool turns Hello world & more into Hello%20world%20%26%20more. The resulting string can safely appear in query values or path segments.
When a space appears in a component, the tool encodes it as %20. The form mode, used for query strings, follows the application/x-www-form-urlencoded standard, where spaces become plus signs. For example, encoding a b!* in form mode produces a+b%21*. The same string decoded returns a b!*, demonstrating a reversible conversion.
How does the form mode differ from component and URI modes?
Form mode applies the application/x-www-form-urlencoded algorithm. It is used when encoding query‑string parameters or form data. In this mode spaces become plus signs, and characters such as ! are encoded. If you need to build a POST body or a URL with a query string, choose form mode.
Can malformed percent‑encodings be safely decoded?
The tool validates percent‑encoded sequences during decoding. If a sequence has fewer than two hexadecimal digits after the percent sign or contains invalid characters, the decoder throws an error rather than producing garbage. For instance, decoding the input %E0%A4%A triggers an exception, and the interface displays a clear message without modifying the output. This behaviour prevents accidental mis‑interpretation of corrupted data.
Frequently asked questions
What characters does URL encoding replace?
URL encoding replaces characters that are not allowed in URLs or have special meaning, such as space, Ampersand, equals, question mark, slash, hash. The encoded form uses a percent sign followed by two hex digits, for example, a space becomes %20.
How does the component mode differ from URI mode?
Component mode uses encodeURIComponent, which leaves only letters, digits and - _ . ! ~ * ' ( ) unencoded; everything else, including +, &, = and /, becomes a percent code. URI mode uses encodeURI, which also keeps the characters that give a URL its structure, such as :, /, ?, & and #, so it suits encoding a complete URL.
When should I use form mode instead of component mode?
Form mode applies the application/x-www-form-urlencoded algorithm. It is used for query‑string parameters or form data. In this mode spaces become plus signs, and characters such as ! are encoded. If you need to build a POST body or a URL with a query string, choose form mode.
What happens if I paste a URL into component mode?
In component mode the whole URL is encoded, including :// and every slash, which is rarely what you want. URI mode keeps the URL structure intact and only encodes characters that are not allowed, such as spaces: https://a.com/path with space becomes https://a.com/path%20with%20space.
Will the tool send my data to a server?
No. Encoding and decoding happen entirely in your browser, and nothing you type is uploaded. Once the page has loaded, the tool even keeps working without an internet connection.