URL Encoder: Percent-Encode a URL or Query Value
By TheToolsBank Editorial TeamLast updated:
How to URL encode text
- Paste a full URL or a single value into the box.
- Pick a mode: Full URL for a whole address, Component for one value you will place inside a URL, or Form (+ for spaces) for form-style data.
- Select Encode URL.
- Select Copy result. Clear empties the box. After you edit the text, select Encode URL again.
In full URL mode, https://example.com/search?q=hello world&lang=en becomes https://example.com/search?q=hello%20world&lang=en. Only the space changes. Square brackets stay, so an IPv6 address like http://[::1]:8080/ still works.
encodeURI vs encodeURIComponent: the three modes
Full URL mode works like JavaScript's encodeURI and keeps the characters that give a URL its structure. Component mode uses encodeURIComponent, which encodes those too. Form mode is like Component with + for spaces.
| Character | Full URL (encodeURI) | Component (encodeURIComponent) | Form |
|---|---|---|---|
| space | %20 | %20 | + |
| / | / | %2F | %2F |
| ? | ? | %3F | %3F |
| & | & | %26 | %26 |
| = | = | %3D | %3D |
| : | : | %3A | %3A |
| # | # | %23 | %23 |
| + | + | %2B | %2B |
| @ | @ | %40 | %40 |
| % | %25 | %25 | %25 |
| [ ] | [ ] | %5B %5D | %5B %5D |
| é | %C3%A9 | %C3%A9 | %C3%A9 |
All modes leave letters, digits, and - _ . * unchanged. Full URL and Component also keep ! ~ ' ( ), which Form mode encodes.
Encoding a value for a query string
Use Component mode for anything you insert after = in a URL. Full URL mode keeps & and =, so a value like a&b=c would split into two parameters. Component mode gives a%26b%3Dc, which stays one value.
Encode just the value. Component mode turns https://example.com/?q=1 into https%3A%2F%2Fexample.com%2F%3Fq%3D1, which no longer works as a link. That output is only right when the whole URL is itself a parameter value, such as a redirect target.
How spaces are encoded: %20 or +
Full URL and Component modes encode a space as %20. Form mode uses + instead, as HTML forms do in the format called application/x-www-form-urlencoded. Servers that read query strings this way accept both. In the path part of a URL, only %20 means a space.
Watch for real plus signs. Full URL mode leaves + as it is, and a server reading a form-style query will turn it into a space. Use Component or Form mode to get %2B.
Non-English characters and emoji (UTF-8)
Characters outside basic ASCII are first turned into UTF-8 bytes. Each byte then gets its own percent code, so one character can become several codes. All three modes give the same result for these.
ébecomes%C3%A9(2 bytes)東京becomes%E6%9D%B1%E4%BA%AC(3 bytes per character)😀becomes%F0%9F%98%80(4 bytes)
To turn percent codes back into text, use the URL Decoder. If you want a clean page address made from a title, a Slug Generator is usually a better fit than encoding the title.
Common Mistakes to Avoid
Encoding a URL that is already encoded
Solution:
Using full URL mode for a query value
Solution:
Encoding a whole link in component mode
Solution:
Using Form mode for a path
Solution:

