Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk3 min

Why Plus Signs Turn Into Spaces in URLs—and How to Keep Them

In form-style query parameters, + represents a space. Encode a literal plus as %2B, and use an encoder and parser that match the receiving API.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A plus sign turns into a space when a query parameter is decoded using application/x-www-form-urlencoded rules. In that format, + represents a space, so a literal plus must be encoded as %2B. This is a form-style parameter convention, not a rule for every part of every URL.

Why does a plus sign turn into a space in a URL?

Many query-string tools use the application/x-www-form-urlencoded format for name-and-value pairs. Under its rules, spaces are serialized as + and a plus sign in a value is percent-encoded as %2B. If a value containing a literal + is passed to a form-style parser without that encoding, the parser reads it as a space. The WHATWG URL Standard defines this form encoding and its parsing behavior.

As an Amazon Associate I earn from qualifying purchases.

This is separate from generic URI syntax. RFC 3986 describes the URI query component, but does not make plus a universal synonym for space. The meaning depends on how the receiving software interprets the query data: a question mark in a URL does not, by itself, tell you which parser or parameter format is being used.

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

How do I keep a plus sign in a query parameter?

Encode the parameter value using the format the receiving endpoint expects. For form-style parameters, encode literal plus signs as %2B and let an encoder handle spaces and other reserved characters. For example, the value C++ becomes C%2B%2B; a space in the same format becomes +.

Prefer a query-parameter API that accepts raw keys and values over assembling a query string by joining text manually. The encoder can then distinguish a literal plus from the plus used to represent a space.

JavaScript: use URLSearchParams for form-style parameters

URLSearchParams serializes parameters using form-urlencoded rules. Its toString() method returns the query string without a leading question mark, and spaces are serialized as +. For example:

const params = new URLSearchParams({ q: "C++" });
const query = params.toString(); // q=C%2B%2B

See MDN’s URLSearchParams: toString() method reference.

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

Python: use urlencode for form-style parameters

urllib.parse.urlencode() uses quote_plus() by default. That matches form-style behavior: spaces become + and literal plus signs are escaped by default.

from urllib.parse import urlencode

query = urlencode({"q": "C++"})
# q=C%2B%2B

Python documents these functions in urllib.parse — Parse URLs into components.

When should spaces be encoded as %20 instead?

Use the representation specified by the receiving API. Some interfaces expect percent-encoded spaces as %20 rather than the form-style +. Python’s quote() is an alternative to quote_plus() for this kind of percent encoding. These approaches are not interchangeable in every context, so follow the endpoint’s parameter-format documentation rather than choosing based only on appearance.

Encoding approach Space representation Literal plus representation Use when
Form-style query encoding + %2B The endpoint expects application/x-www-form-urlencoded semantics, as with Python urlencode() defaults and JavaScript URLSearchParams.
Percent encoding with spaces as %20 %20 Use the encoder’s percent-encoding result for a literal plus, typically %2B. The API contract calls for this representation; Python’s quote() is one documented option.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How should you decode a query parameter?

Use a decoder that matches how the value was encoded, and decode the parameter value rather than applying substitutions to the whole URL. Python’s unquote_plus() treats plus as a space; unquote() percent-decodes without that form-specific conversion. The distinction is documented in Python’s urllib.parse reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • For form-urlencoded data, use a form-aware parser or unquote_plus().
  • For data where plus is literal and spaces use percent encoding, use a compatible percent-decoder such as unquote().
  • Do not run repeated percent-decoding passes: RFC 3986 cautions that decoding more than once can change the meaning of data.

A global replacement such as changing every + in a URL to a space is unsafe. URLs have different components and parsing rules; such a replacement can corrupt a literal plus or alter text outside the parameter value.

Quick troubleshooting checklist

  • Check the receiver’s contract: determine whether the endpoint expects form-urlencoded parameters or another query format.
  • Check the encoded URL: a literal plus in a form-style value should appear as %2B; a space in that format appears as +.
  • Check the parser: confirm it is parsing the query parameter using the same format used to encode it.
  • Encode and decode once: avoid manual string replacements and repeated percent-decoding.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.