URL Encode/Decode
Encode and decode URL components.
About the URL Encode/Decode
Press Encode and every space becomes %20, the escape that is valid in any part of a URL; press Decode and %20 comes back as a space. The same pass escapes slashes, ampersands and non-ASCII text, which is encoded as its UTF-8 bytes. Both directions run in your browser tab, which matters when the URL carries a session token or a search term you would rather not hand to a third party.
How to use the URL Encode/Decode
- Paste your text or URL into the input panel, or press Sample to load an example.
- Press Encode to escape it: spaces become %20, and / ? & become %2F %3F %26.
- Press Decode to expand an encoded string back into readable text.
- Swap any + for a space before decoding a form-encoded query string; the decoder reads + as a literal plus.
- Press Copy for the clipboard, or Download to save url.txt.
Frequently asked questions
- How do I URL encode a space?
- Paste the text and press Encode. Every space becomes %20, so hello world encodes to hello%20world. A space in a URL cannot be left raw, and %20 is the escape that works in every part of one: path, query string and fragment. Repeated spaces are each encoded rather than collapsed, so two in a row become %20%20.
- When is a space encoded as a plus sign instead of %20?
- Only in form encoding. The application/x-www-form-urlencoded rules, used by submitted HTML forms and by JavaScript's URLSearchParams, write a space as +, so the value a b arrives as q=a+b where this tool encodes it as a%20b. Percent-encoding is the safer default: %20 is understood anywhere in a URL, while + means a space only inside a form-encoded body or query string.
- Why does the decoder leave my plus signs alone?
- Because to a percent-decoder a + is simply a plus sign: decoding a+b returns a+b, not a b. This tool follows that rule exactly, so a query string built by a form keeps every space as a + when you decode it here. Replace the plus signs with spaces first, or read the string with URLSearchParams, which turns q=a+b back into a b.
- How do I URL encode a plus sign?
- Press Encode: + becomes %2B, and decoding %2B returns the plus sign. Escape it whenever the value genuinely contains one. A phone number such as +1 555 0100 encodes to %2B1%20555%200100, and a tagged email address needs the same treatment, because an unescaped + in a query string is read as a space by anything that form-decodes it.
- Why did my space encode as %C2%A0 rather than %20?
- Because the character was not an ordinary space. Text pasted from a document, a PDF or a design tool often carries a non-breaking space (U+00A0), which encodes as its UTF-8 bytes %C2%A0. A tab encodes as %09 for the same reason. Retype the gap if you meant a plain space.
- What exactly gets encoded?
- Everything except letters, digits and the nine characters - _ . ! ~ * ' ( ). So https://4devs.app/search?q=hello world becomes https%3A%2F%2F4devs.app%2Fsearch%3Fq%3Dhello%20world, with the colon, slashes, question mark and equals sign escaped alongside the space. This is component encoding: use it on the values you insert into a URL, not on a whole URL you still want to be clickable.
- What does "URI malformed" mean?
- The input contains a percent sign that is not followed by two hex digits, or bytes that are not valid UTF-8. A literal 100% fails for the first reason and %E0%A4%A for the second. Escape a literal percent sign as %25 and it decodes cleanly. A doubly-encoded string comes back one layer at a time: %2520 decodes to %20, and decoding again gives a space.
- Does it handle accents and non-Latin scripts?
- Yes. Text is encoded as UTF-8 bytes, so café becomes caf%C3%A9 and naïve becomes na%C3%AFve. Decoding reverses it exactly, provided the input really was UTF-8.