You are building a link by hand and the value you need to put in it is fish & chips? today. It has a space in it, an ampersand and a question mark, and every one of those characters means something else to a URL. Paste it in raw and the link will not carry your value. It will carry a shorter value, plus a stray extra parameter you never asked for.
The fix is percent encoding, and it takes about ten seconds once you pick the right mode. This guide walks through encoding spaces, symbols and special characters with the free URL Encoder/Decoder on Ovatly, with the same value run through both of the tool's modes so you can see exactly what each one does.
Contents
- Quick answer
- What each character becomes
- The two modes, and why the choice matters
- How to encode a value, step by step
- Worked example: one value, two modes
- Worked example: a whole address in Full URL mode
- Decoding back
- Limitations and honest warnings
- Common mistakes
- FAQs
- Conclusion
Quick answer
For a single value going into a query string, open the URL Encoder/Decoder, choose Component mode, paste the value, and press Encode. Component mode encodes everything a URL cannot carry raw, including &, =, ? and /. For a whole address that has a space in it, choose Full URL mode instead: it encodes spaces and stray characters while keeping the address structure intact. Spaces become %20 in both modes. This tool uses %20, not +, which is valid everywhere in a URL.
What each character becomes
Encoding replaces a character with a % sign and the character's byte value in two hexadecimal digits. The ones you will meet most often:
- Space becomes
%20 &becomes%26?becomes%3F=becomes%3D/becomes%2F#becomes%23+becomes%2B
Letters, digits and the marks -, _, . and ~ are never encoded. They have no structural job in a URL and travel raw, so most ordinary text passes through unchanged and only the awkward characters grow.
The two modes, and why the choice matters
The tool has two modes because "encode this text" means two different things depending on what the text is.
Component mode treats the input as one value, a single search term, name or redirect target that will sit inside a larger URL. A value must not contain anything that looks like URL structure, so this mode encodes the structural characters too: &, =, ? and / all become percent sequences. Inside a value, an ampersand is data, and the encoding says so.
Full URL mode treats the input as a complete address. A complete address needs its structure to survive, so this mode deliberately leaves the structural characters alone and only encodes what cannot travel at all, mainly spaces and stray characters. Encode a whole address in Component mode by mistake and the : and / that hold it together become %3A and %2F, and the address stops being an address.
Picking the mode is the only real decision in the process. Everything after it is a paste and a press.
How to encode a value, step by step
- Open the URL Encoder/Decoder.
- Choose Component mode for a query value, or Full URL mode for a whole address.
- Paste your text or URL.
- Press Encode or Decode.
- Copy the result.
Worked example: one value, two modes
Take the value fish & chips? today. It needs to travel as one query value, so Component mode is the right choice. Encoding gives:
fish%20%26%20chips%3F%20today
Read it piece by piece. The two spaces became %20. The ampersand became %26, so no query parser will mistake it for the start of a new parameter. The question mark became %3F, so it cannot be mistaken for the start of a query string. The letters passed through untouched. Put this in an address as ?q=fish%20%26%20chips%3F%20today and the receiving end decodes it back to the full original phrase.
Now run the same value through Full URL mode and the difference is the lesson. Full URL mode encodes the spaces but leaves the & and ? raw, because in a whole address those characters are structure. The result still splits at the ampersand. Neither mode is wrong; they answer different questions. A value asks "protect everything", a whole address asks "protect only what cannot travel".
Worked example: a whole address in Full URL mode
Here is the job Full URL mode exists for. The address https://example.com/a b?q=x y has spaces in the path and in the query value. Encoding it in Full URL mode gives:
https://example.com/a%20b?q=x%20y
The spaces became %20, and everything structural, the : after https, the / separators, the ? and the =, is exactly where it was. The address works, and the values arrive intact.
One caution this example hides. In that address the query value was a single word, x y. If a value inside a whole address contains its own &, like a dish name of fish & chips, Full URL mode leaves that ampersand raw and it will still split the parameters. Encode that value separately in Component mode first, then build the address with the encoded value in place.
Decoding back
The same tool runs in reverse. Paste an encoded string, press Decode, and the percent sequences turn back into the original characters. Decoding is exact: what comes out is character for character what went in before encoding.
Decoding is also where bad input shows itself. A stray %, or an incomplete sequence like %2 at the end of a string, cannot be decoded, because a percent sign promises two hexadecimal digits after it. The tool produces a clear error in that case instead of garbage, which usually means the string was cut short when it was copied.
Limitations and honest warnings
Encoding is not encryption. Anyone can decode a percent-encoded string with this same tool, so an encoded value in a URL is not hidden, protected or private. Never encode a password or a key and treat the result as safe to share.
The tool also encodes exactly what you paste, in the mode you pick. It does not know that the value you are encoding contains an ampersand that was meant as structure, or that the address you pasted is missing a character. Mode choice and input are yours; the conversion is mechanical.
And encoding fixes transport, nothing else. It will not repair a broken link whose target does not exist, and it will not make an unsafe value safe to use at the receiving end. It makes characters safe to carry, which is a smaller and more specific promise.
Common mistakes
- Encoding a value in Full URL mode. The
&and?inside the value stay raw and split it apart at the receiving end. Values belong in Component mode. - Encoding a whole address in Component mode. The structural characters get encoded and the address breaks. Whole addresses belong in Full URL mode.
- Using
+for spaces outside form data. In form-produced query strings+means a space, but in a path it means a literal plus. This tool uses%20, which is valid everywhere. - Encoding twice. Encoding an already encoded string encodes the
%signs too, turning%20into%2520, and the value decodes back to literal percent text. Encode once, from the raw text. - Copying an encoded string with a piece missing. A truncated
%2at the end makes the whole string undecodable. Copy the full result.
FAQs
Which mode do I need? If you are building one value inside a URL, like a search term or a redirect target, use Component. If you have a whole address with a space in it, use Full URL.
Why did my encoded text get longer?
Each unsafe character becomes three characters, like %20 for a space. Non-ASCII characters take even more, since they are encoded as their UTF-8 bytes.
What happens if I decode a string with a stray % in it?
The tool gives a clear error instead of garbage. A stray % or an incomplete sequence like %2 at the end cannot be decoded, because a percent sign must be followed by two hexadecimal digits.
Does Full URL mode encode the & and ? in my address?
No. Full URL mode deliberately leaves the structural characters alone so the address keeps working. That is exactly why a single value with its own & or ? in it belongs in Component mode instead.
Does encoding change my data? No. Encoding is a reversible way of writing the same bytes. Decode the result and you get the original text back exactly, character for character.
Conclusion
Spaces and symbols break URLs only when they ride raw inside a value, and the fix is mechanical: Component mode for one value, Full URL mode for a whole address, encode once, and the URL Encoder/Decoder does the rest. If you want the thinking underneath the keystrokes, why a byte becomes a percent sign and two hex digits at all, read What Is Percent Encoding and When Do URLs Need It. For more tools like these, see the Developer Tools guide archive.