URL Encode Spaces to %20

Turn spaces into %20 with encodeURIComponent. See the difference between %20 and +, and encode any string online.

Part of the free URL Encoder. Runs in your browser — nothing is uploaded.

URL Encode Spaces to %20

A raw space is not legal in a URL. encodeURIComponent turns each space into %20, which is what you want in path segments and query values. The + form is only for application/x-www-form-urlencoded bodies.

Worked example: A phrase with spaces

Text

hello world from KaviForge

Encoded

hello%20world%20from%20KaviForge

Practical tip

If a server shows a literal plus in the decoded value, it expected %20 and you sent +. Switch the encoder to spaces-as-%20.

How to use this URL Encoder

  1. 1Use the live tool above — it runs entirely in your browser and never uploads your data.
  2. 2Paste the sample from the worked example, or use your own input.
  3. 3Copy the result, then adapt the same steps in your editor, script, or pipeline.

URL Encode Spaces to %20 FAQs

Is %20 the same as +?

They both represent a space, but in different encodings. Use %20 in URLs and + only in HTML form bodies.

Should I encode spaces in a full URL?

Encode each component. Encoding a whole URL with encodeURIComponent will also encode :, / and ?, which breaks the URL.