Do not delete a link space until you know what it means

A visible space in a copied link may be a typing error, a line-wrapping artifact, part of a file name, or data inside a search query. These cases need different repairs. Deleting every space can produce a syntactically tidy URL that points to the wrong resource.

For example, /reports/my file.pdf and /reports/myfile.pdf describe different path names. If the server stores a file named my file.pdf, the safe URL form normally preserves that character through percent-encoding as /reports/my%20file.pdf. Removing it changes the requested name.

First identify the URL component

https://example.com/folder/my file.html?q=blue shirt#size chart \____/ \_________/\__________________/ \__________/ \________/ scheme host path query fragment
LocationWhat a space may indicateSafer action
Scheme or hostA broken or mistyped URLCheck the original domain; do not invent a repair
PathA character in a folder or file nameUse URL percent-encoding, commonly %20
QueryData in a search, filter, or form valueLet a URL-aware encoder serialize the value
FragmentPart of an in-page identifierEncode it and confirm the target still exists
Outside the URLText added by a message or documentRemove only the surrounding prose or accidental break

Spaces are not valid literal characters in a web URL. URL parsers and serializers encode them when they belong to a path, query, or fragment. A space inside the host is different: domain names do not gain meaning by replacing that space with %20. Return to the original source and confirm the intended hostname.

Use %20 for a space in a URL path

Percent-encoding represents a byte as a percent sign followed by two hexadecimal digits. In UTF-8 and ASCII, an ordinary U+0020 space is byte 20, so its percent-encoded form is %20. This preserves the path character without sending a literal space.

Intended file name: quarterly report.pdf Unsafe literal URL: https://example.com/quarterly report.pdf Encoded URL: https://example.com/quarterly%20report.pdf Different name: https://example.com/quarterlyreport.pdf

Encode the path component rather than applying an encoder to an already complete URL. Encoding the entire string can mistakenly transform the structural colon and slashes in https://. Also avoid encoding an existing percent sign a second time: %20 can become %2520, which has a different meaning.

When a plus sign means a space

A plus sign is commonly used for a space in data serialized with the application/x-www-form-urlencoded format. Browser APIs such as URLSearchParams use this convention for query parameters. Thus a query may serialize blue shirt as q=blue+shirt.

This rule is not universal across a URL. In a path, + is normally a literal plus character, not a replacement for a space. Even in a query, the receiving application decides how values are interpreted. Use a URL or form encoder for the specific query value instead of manually changing every space to +.

Path space: /blue shirt/photo.jpg → /blue%20shirt/photo.jpg Form-style query value: ?q=blue shirt → ?q=blue+shirt Literal plus in a path: /grade+A/ stays distinct from /grade%20A/

Safe workflow for a copied link

  1. Keep the original link and, if possible, return to the page or message where it appeared.
  2. Remove surrounding quotation marks, brackets, punctuation, or prose that is clearly outside the link.
  3. Check whether a document inserted a line break in the middle of the URL. Join only that accidental visual break.
  4. Separate the scheme, host, path, query, and fragment before editing values.
  5. For an intended ordinary space in a path, preserve it as %20.
  6. For query data, use a URL-aware API or form encoder so separators such as & and = are not confused with data.
  7. Open the result in a new tab and confirm the domain, destination, and page content before sharing it.

If the link contains sign-in tokens, private document IDs, email addresses, or other sensitive query data, avoid pasting it into an unfamiliar online utility. Modern browser address bars and local programming APIs can serialize URLs without sending the link to a third party.

Look for invisible pasted characters

A gap that resembles an ordinary space may actually be a no-break space, zero-width character, tab, or line break copied from a PDF, email, or rich-text editor. Blind deletion can hide the source of the problem. Inspect a non-sensitive sample and compare the character positions with the original.

Read the Unicode Whitespace Characters guide when a link still fails after ordinary spaces are handled. The Zero-Width Characters tool and Non-Breaking Spaces tool can help audit plain, non-sensitive text. They are text transformers, not URL encoders or link validators.

Changes that can break or redirect a URL

  • Deleting meaningful path spaces: changes the folder or file name.
  • Replacing path spaces with plus signs: usually requests a literal + path instead.
  • Encoding the whole URL: can encode structural delimiters that separate components.
  • Double-encoding: can convert an existing %20 into %2520.
  • Decoding reserved characters too early: can turn encoded data into delimiters such as /, ?, or #.
  • Guessing a spaced hostname: can send you to the wrong domain or nowhere at all.

Frequently asked questions

Should I remove spaces or replace them with %20?

Replace an intended ordinary space in a path with %20. Delete it only when you have evidence that it was accidental and was never part of the path name or data.

Can I replace a link space with +?

Use + only when a query value is being serialized with the form URL-encoded convention. Do not treat it as a universal space replacement, especially in a path.

Why does a copied link contain spaces?

The URL may represent a spaced file name or query value, or the copying source may have inserted line wrapping, a no-break space, or surrounding prose. Compare it with the original clickable link before editing.

Can Remove Spaces Online repair my URL?

No. The site can inspect or transform whitespace in plain text, but it does not parse URL components, encode parameter values, verify destinations, or detect malicious links. Use a URL-aware encoder and test the destination.

References