An ampersand in a search term can turn part of your text into a separate URL parameter. That's the problem I want to fix before you copy a link into a form or message. If you're looking for how to encode a URL online, my starting point is simple: decide which part is data and which part holds the address together. Then encode the data, check the result, and keep private information out of the process.
What does URL encoding do, and what doesn't it do?
I think of URL encoding as a way to label characters so a URL reader knows they're data. A space becomes %20. An ampersand that belongs inside a value becomes %26. Those changes help preserve what you meant, but they don't tell you whether the destination is trustworthy.
Why percent signs appear
The rule in RFC 3986 is precise: percent-encoding represents a byte with a percent sign and two hexadecimal digits. I don't need to memorise those digits to use an encoder. I do need to recognise that %20 can represent a space, rather than text someone deliberately typed.
I leave letters, digits, hyphens, periods, underscores, and tildes alone because they're unreserved characters. Other characters can carry structural meaning. In https://example.com/search?q=summer&sort=date, the question mark starts the query and the ampersand separates parameters. I leave those separators alone because they're doing their intended jobs.
But I don't use encoding to validate an address, repair a missing page, or encrypt private information. Someone who can read the encoded text can decode it. I separate these jobs from the start: encoding preserves data, validation checks structure, and testing checks whether the destination behaves as expected.
How do I encode a URL online with URL Encoder?
I built URL Encoder and tried this workflow on my budget Android phone and laptop. I start with a harmless value rather than a private link. For this example, my search text is summer sale & clearance, and the surrounding address is https://example.com/search?q=.
- Keep an unchanged copy of the original text so you can compare it later.
- Open URL Encoder and paste only summer sale & clearance into its input.
- Run the encoding operation and inspect the output. For component percent-encoding, expect summer%20sale%20%26%20clearance.
- Put that encoded value after q=, keeping the surrounding address intact.
- Check the final address: https://example.com/search?q=summer%20sale%20%26%20clearance.
- With your real, trusted destination, test whether the receiving page reads the complete search phrase.
I use example.com here to show the address structure, not as a working search service. On your actual website, a page loading isn't enough. Check the displayed search text or the parameter received by the application. A page can load while silently dropping everything after an unescaped ampersand.
Tip from me: I copy only the value before opening the encoder. That small choice makes it much harder to accidentally encode the whole address.
Should I encode the whole URL or just one value?
My decision depends on where the text will go. A complete destination address needs its separators. But that same address becomes data when I put it inside another URL's parameter. So the right question isn't whether the input looks like a URL. It's what role that input has at its destination.
| What I'm preparing | What I encode | What I preserve |
|---|---|---|
| A normal link to a page | Only components that need it | The address structure |
| A search parameter | The raw search value | The surrounding ?q= and other separators |
| A campaign parameter | The raw campaign value | Parameter names and separators |
| A destination URL inside another URL | The entire inner URL as one value | The outer URL structure |
| One path segment containing data | That segment using the destination's rules | Slashes that separate actual path segments |
A nested URL is the useful exception
Suppose my inner destination is https://example.com/page?ref=email&id=42. As one outer parameter value, its component-encoded form is https%3A%2F%2Fexample.com%2Fpage%3Fref%3Demail%26id%3D42. Here I want its separators encoded. Otherwise, the receiving system could mistake the inner &id=42 for another parameter belonging to the outer URL.
I make the same distinction with paths. A slash separating folders isn't the same as a slash inside a piece of data. I follow the destination's path rules rather than assuming I can replace either one without changing the meaning. If I can't identify the parts, I inspect the address with URL Parser before changing it.
How do I encode spaces and special characters?
I use the table below to check individual characters inside a component. It isn't a rule to replace every matching character in a finished address. For example, I encode a question mark inside a search value, but I keep the question mark that introduces the address's query.
| Original data | Encoded form | What I'm preserving |
|---|---|---|
| A space | %20 | A space inside the text |
| Ampersand | %26 | An ampersand inside one value |
| Question mark | %3F | A literal question mark |
| Hash character | %23 | A literal hash character |
| Percent sign | %25 | A literal percent sign |
| Plus sign | %2B | A literal plus sign |
| Equals sign | %3D | An equals sign inside data |
I keep non-English text intact
I don't remove accents or change someone's words just to make a URL look simpler. Google Search Central recommends percent-encoding non-ASCII characters in links as needed. I keep the original text and let the URL-building method handle its representation.
If I'm unsure about the result, I inspect the encoded component with URL Decoder and compare it with my original text. I want the words to survive the conversion, not just an address that looks tidy. And I keep that check separate from testing how the destination reads the finished link.
Does a space become + or %20 in a URL?
I don't use an always-plus or always-%20 rule. Percent-encoding represents a space as %20. Form-style query serialization represents spaces as +. Both appear in real links, but the receiving parser determines how they're read. I follow the service's expected format rather than changing symbols until the address looks familiar.
- For a component percent-encoding example, I expect red shoes to become red%20shoes.
- For form-style query serialization, I expect the same words to become red+shoes.
- For a literal plus inside a form-style value, I use %2B so it isn't read as a space.
The MDN URLSearchParams documentation explains form-style query serialization. Its constructor documentation also warns that parsing a query string treats + as a space. So if my intended value is a+b, leaving the plus untouched can produce a b after parsing. Encoding the literal plus protects that distinction.
I avoid replacing every + with %20 across a complete address. That would assume all plus signs have the same role. Instead, I identify the query value, establish whether it's raw or already serialized, and check the receiving system's rules. A correct conversion preserves meaning, not just a preferred visual style.
How do I avoid double-encoding and decode safely?
My biggest warning sign is an unexpected %25. Encoding a literal percent sign produces %25, so encoding an existing %20 produces %2520. After one decoding step, that becomes the text %20 rather than a space. That extra layer can explain a search term that suddenly displays percent signs.
An encoded-looking value still needs context
I treat percent signs followed by two hexadecimal digits as a clue, not proof that the whole value is ready. A string can contain both encoded and raw text. And someone might genuinely want the text %20 in their value. I check where the input came from before deciding to encode or decode it.
- Save the exact input before changing it.
- If it is known to be encoded, inspect one component with URL Decoder.
- Compare the decoded value with the text you intended to send.
- Return to the original raw value and encode it once for the intended destination.
I use URL Decoder for inspection, not to repeatedly decode until the output looks readable. RFC 3986 warns against encoding or decoding the same string more than once. Decoding a whole address can also expose separators that were deliberately protected inside one value, changing how a later parser reads it.
Is it safe to paste private text into an online encoder?
I keep secrets out of online encoding workflows. A polished page or a familiar domain doesn't establish what happens to pasted text. Before using any service with confidential input, I need clear information about its processing and privacy practices. If that isn't clear, I use a trusted local method instead.
- I inspect the input before pasting it.
- I look for passwords, session tokens, password reset links, and one-time codes.
- I replace confidential values with harmless sample text when checking formatting.
- I check what the service says about processing.
- I look for a clear explanation of browser-side or server-side handling.
- I don't assume that an encoding tool processes locally just because the calculation is simple.
- I review where the final URL will be stored or shared.
- I consider browser history, server logs, and shared systems.
- I don't put a secret back into the finished URL after testing.
The OWASP explanation of query-string exposure describes how sensitive values can appear in browser history, logs, shared systems, and Referer headers. HTTPS doesn't remove those risks. Encoding a token merely changes its representation, so I don't treat an encoded token as protected.
Tip from me: I test a private link's shape with dummy values. That lets me check separators and encoding without copying the real credentials into another place.
Should developers use encodeURI or encodeURIComponent?
I use the distinction in MDN's encodeURI documentation: encodeURI preserves URL syntax characters such as ampersands, question marks, and hash characters, while encodeURIComponent is intended for individual components or values. Using encodeURI on a search value containing an ampersand won't protect that ampersand as value data.
For application code, I prefer a URL builder
For production work, I prefer URL and URLSearchParams, or the platform's equivalent, over joining strings by hand. Google's URL encoding guidance recommends platform URL-building libraries. I give the builder raw parameter values and let its documented serialization rules handle them, rather than pre-encoding a value that the builder may encode again.
- I use a component encoder when I explicitly need one encoded component.
- I use URLSearchParams for form-style query parameters, remembering its treatment of spaces and plus signs.
- I follow the destination API's rules when it specifies a particular query or path format.
- I avoid passing a manually encoded value into another encoding step without a documented reason.
For campaign links, I can organise the work with UTM Builder, but I still inspect the finished parameters. An online encoder is useful for learning and checking individual values. I wouldn't make manual copying between browser tabs the foundation of application code that builds links repeatedly.
What mistakes should I check when the link still fails?
I start with the original value and compare one component at a time. Re-encoding the entire failed address usually makes diagnosis harder. My first checks are whether I encoded the correct scope, whether a value already contained escapes, and whether the receiving system expects form-style query data.
- If the address begins https%3A%2F%2F, I check whether I mistakenly encoded a top-level URL as a component.
- If text disappears after an ampersand, I check whether an ampersand inside the value was left unencoded.
- If a plus becomes a space, I check form-style parsing and whether the literal plus needed %2B.
- If the page shows %20, I look for an extra encoding layer such as %2520.
- If the page still doesn't load, I check the host, path, access requirements, and destination rather than blaming encoding alone.
I can inspect structure with URL Validator, but a valid-looking address isn't proof that the page exists or is safe. For a known destination, I test the completed link and confirm the application received the intended text. For an unfamiliar destination, I inspect it before opening it.
I also avoid applying a service-specific limit to every URL. Google's Maps guidance gives a 16,384-character limit for Google Maps Platform web services and static web APIs, not a universal browser limit. If a long address fails, I check the actual destination's documentation. Encoding fixes representation, not every limit imposed by the system receiving the link.
Questions people ask
How do I encode a URL online?
I first identify whether I'm preparing one component or a complete address. For a query value, I paste the raw value into URL Encoder, encode it once, and place the result into the surrounding URL. Then I inspect the separators and test the finished link with its intended destination.
Should I encode the whole URL or just the query value?
I normally encode the query value and preserve the surrounding address structure. The main exception is a complete URL being carried inside another URL's parameter. In that case, I encode the inner URL as data while leaving the outer URL's structural separators in place.
Does a space become + or %20 in a URL?
I expect %20 from percent-encoding and + from form-style query serialization. I don't assume every parser treats them identically. When I need a literal plus in a form-style value, I encode it as %2B, because a raw plus can be interpreted as a space.
How can I tell whether a URL is already encoded?
I look for sequences such as %20 and %26, then check the source and intended meaning. Those sequences are clues, not proof that every part is encoded correctly. If needed, I decode one component for inspection and compare it with the original rather than encoding the whole address again.
Is URL encoding the same as encryption?
No. I use encoding to preserve characters during URL processing, not to hide them. Anyone who can inspect the encoded value can decode it. I keep passwords, session tokens, and other secrets out of URLs because encoded query values can still appear in history, logs, and shared systems.
How do I decode a percent-encoded URL?
I keep an unchanged copy, identify the component I want to inspect, and use URL Decoder for one decoding step. Then I compare the result with the intended text. I don't repeatedly decode a whole address, because exposing reserved separators can change how another system interprets its structure.
What to do next
I would start with one harmless value, not a whole collection of links. Open URL Encoder, paste the raw component, and encode it once. Keep the surrounding URL separators intact, then inspect the finished address and check what the receiving page actually reads. If you see unexpected %25 sequences or a plus turning into a space, return to the original value before trying again. And keep secrets out of both the tool input and the final URL. That gives you a repeatable process without confusing correct formatting with privacy or trust.