Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Build the URL with its query parameters intact, and percent-encode any plus sign or ampersand that is literal data inside a parameter value: use %2B for + and %26 for &. Keep the structural & between parameters unencoded. The receiving application’s parser determines how query values are interpreted.

Why plus signs and ampersands can change a search URL

A query string commonly uses key=value&key=value: the equals sign connects a parameter name to its value, and the ampersand separates one parameter from the next. Google Search Central describes this common arrangement in its URL structure guidance.

That means an unencoded ampersand inside a value can be mistaken for a parameter separator. For example, if a search term is cats&dogs, writing it raw in ?q=cats&dogs may cause a parser to treat dogs as another parameter rather than part of q. Encode the literal ampersand as %26: ?q=cats%26dogs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A plus sign also needs care. RFC 3986 classifies both & and + as reserved characters, and the role of a reserved character depends on the URI scheme or application syntax. Some form-style query parsers interpret an unencoded plus as a space, so encode a literal plus as %2B when that convention may apply. For example, use ?q=C%2B%2B to send the literal search term C++.

Encode data, not the query structure

Do not replace every ampersand in a URL. Encode only an ampersand that belongs to a value; leave the ampersands that separate parameters in place. Likewise, use = to assign each parameter value, and encode a plus sign within a value if the receiver might parse it as a space.

What the character means How to write it Example
Parameter separator Keep & raw ?q=tea&lang=en
Literal ampersand within one value Use %26 ?q=tea%26honey
Literal plus within one value Use %2B ?q=C%2B%2B

RFC 3986 explains the reason: “If data for a URI component would conflict with a reserved character’s purpose as a delimiter, then the conflicting data must be percent-encoded before the URI is formed.” The RFC also advises separating URI components before decoding percent-encoded octets; decoding a reserved character too early can turn data back into something that looks like a delimiter. See RFC 3986.

Build a demo search URL safely

  1. Identify the parameter names and values. For example, q may hold the search text and lang may hold a language setting.
  2. Encode reserved characters that are data within a value. In the search text tea&honey + lemon, encode the literal ampersand as %26 and the literal plus as %2B. A space may be represented according to the target application’s rules.
  3. Assemble the query string. Keep the structural equals signs and parameter-separating ampersands. The resulting example is ?q=tea%26honey%20%2B%20lemon&lang=en, assuming the target accepts percent-encoded spaces as %20.
  4. Check what the destination receives. If exact interoperability matters, test with the actual search application or consult its query-parameter documentation. A URL’s parser, not the visual appearance alone, determines whether a character is treated as syntax or data.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Generic URI syntax versus form-style query parsing

At the generic URI level, RFC 3986 treats reserved characters according to component and delimiter context; it does not establish one universal interpretation for every query parser. Form-style query parsing is an application convention in which a raw plus has commonly represented a space. The W3C’s historical URI documentation describes that convention and notes that a literal plus in that context must be encoded; actual behavior still depends on the receiving application. See the W3C URI documentation.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For reliable sharing, percent-encode a literal + as %2B and a literal & as %26 inside values, while leaving actual parameter separators intact. Decode values only after the URI has been parsed into its components.

Quick Recap

SaleBestseller No. 1

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.