Quick answer
Special characters need URL encoding when they would break a URL or change its meaning. Use the URL Encoder Decoder to test small values, especially spaces, ampersands, equals signs, question marks, hashes, percent signs, plus signs, slashes, and non-ASCII text. Do not treat encoding as privacy; encoded characters can still be decoded.
Test URL special characters safelyWhy special characters matter in URLs
A URL is not just text. Characters such as ?, &, =, #, /, %, and + can have special roles depending on where they appear. If one of those characters is meant to be data inside a value, leaving it unencoded can split a query string, change a parameter, break a redirect, or make the URL behave differently than expected.
This is why URL encoding is different from HTML entity encoding, which helps display reserved characters in HTML, and different from Base64 encoding, which is reversible encoding outside normal URL escaping.
Special characters to watch closely
- Spaces: commonly encoded as %20, and sometimes represented as + in form-style query encoding.
- Ampersand &: separates query parameters, so it should be encoded as %26 when it is part of a value.
- Equals sign =: separates a query key from its value, so encode it when it belongs inside the value.
- Question mark ?: starts the query string, but should be encoded when it is data inside another value.
- Hash #: starts a fragment in many URLs, so encode it when it should be part of the value.
- Percent sign %: starts percent-encoding, so broken or incomplete percent sequences can create confusing results.
- Slash /: separates path segments, but may need encoding when it is part of a value or nested redirect parameter.
- Non-ASCII text: names, locations, and international characters may be encoded so the URL travels consistently.
Practical example: ampersands and equals signs in a query value
In this example, the value itself contains an ampersand and an equals sign. If those characters are not encoded, they can be mistaken for query string structure.
brand=A&B size=largebrand%3DA%26B%20size%3Dlarge?note=brand%3DA%26B%20size%3DlargeWhat changed: the equals signs became %3D, the ampersand became %26, and the space became %20. What stayed the same: the decoded note still reads as brand=A&B size=large.
Mini decision rule
Common cases where special characters break URLs
- Search queries with spaces or punctuation.
- Query strings where an unencoded ampersand splits one value into two parameters.
- Redirect URLs stored inside another URL parameter.
- Hashtags or fragments that should be part of a value rather than a page fragment.
- Names, places, or product values with non-ASCII characters.
- Copied URLs with percent signs that are already partly encoded.
- API URLs that contain special values from forms or filters.
- Broken links caused by unescaped characters in campaign or tracking parameters.
Best practices for URL special characters
- Understand whether a character is data or URL syntax before encoding it.
- Avoid changing ?, &, =, or # accidentally when they define the URL structure.
- Watch for percent signs because broken percent-encoding can create confusing decoded output.
- Review decoded output before copying it into production links.
- Avoid storing sensitive information in query strings even when it is encoded.
- Keep an original copy of important URLs before testing encoded variants.
Privacy and safe link handling note
FAQ
Which characters need URL encoding?
Characters that can change URL structure often need encoding when they are part of a value. Common examples include spaces, ampersands, equals signs, question marks, hashes, percent signs, plus signs, slashes in values, and non-ASCII text.
Why do ampersands break query parameters?
In a query string, an ampersand separates parameters. If an ampersand is part of a value, encode it as %26 so it is not treated as a separator.
What does %20 mean in a URL?
%20 is a percent-encoded space. Some form-style query values may use a plus sign for a space, so context matters when decoding.
Should I encode slashes in a URL?
A slash usually separates path segments. Encode it only when the slash is meant to be data inside a value, such as a nested redirect parameter or literal text value.
Can URL encoding hide private data?
No. URL encoding is reversible and should not be used to hide private data. Avoid putting secrets, tokens, passwords, or sensitive personal information in URLs.