Free Tools
By Fadhil Abdulla

URL Encoding Explained: %20, + and When to Encode

What percent-encoding is, why spaces become %20, the difference between encodeURI and encodeURIComponent, and how to avoid double-encoding bugs.

Editorial disclosure: Pyalm publishes and maintains the products and free tools discussed on this site. Regulatory statements are linked to primary sources where applicable. No independent professional review is claimed unless a reviewer is explicitly named.

URLs can only contain a limited set of characters. Everything else — spaces, ampersands, Arabic or Hindi text, emoji — must be percent-encoded before it goes into a link. Get it wrong and parameters break, search terms get cut off, or redirects go to the wrong place.

How percent-encoding works

Each unsafe byte is written as % followed by two hex digits. A space is byte 0x20, so it becomes %20. Non-ASCII characters are first converted to UTF-8 bytes, so é becomes %C3%A9 and an Arabic letter becomes four or six characters.

Character Encoded
space %20 (or + in form data)
& %26
= %3D
/ %2F
? %3F
# %23
é %C3%A9

Encode values, not whole URLs

The most important rule: build the URL from parts and encode each value.

https://example.com/search?q= + encode(Dubai Mall & Café)

gives ?q=Dubai%20Mall%20%26%20Caf%C3%A9. If you forgot to encode, the & would start a new parameter and your search term would be cut to "Dubai Mall ".

encodeURIComponent vs encodeURI

Function Leaves alone Use for
encodeURIComponent letters, digits, - _ . ! ~ * ' ( ) A single value — query parameter, path segment, a URL inside a parameter
encodeURI all of the above plus : / ? & = # ; , + @ A complete URL that only needs spaces and Unicode fixed

In almost every case you want component encoding. The free URL Encoder / Decoder offers both modes.

%20 or +?

Both can mean a space, but + only means space in the query string of form-encoded data (application/x-www-form-urlencoded). In a path, + is a literal plus sign. When decoding query strings that came from an HTML form, treat + as space; elsewhere, don't.

Double encoding

If you see %2520 in a URL, something encoded an already-encoded value: %20 became %25 + 20. Common causes: encoding a value twice in code, or passing an encoded URL to a library that encodes again. Decode once and check whether %XX sequences remain.

Inspecting a URL

Paste a full URL into the Parse mode of the URL tool to see its protocol, host, path and every query parameter decoded in a table — handy for checking UTM tags on campaign links or debugging redirect parameters.

Where this matters for business sites

  • UTM-tagged campaign links with spaces or ampersands in campaign names
  • WhatsApp click-to-chat links with a prefilled message — the message must be encoded
  • Search and filter pages that put user input into the URL
  • Redirect parameters (?next=/account), which must be encoded and validated to prevent open redirects

Pyalm builds websites and web apps where URLs, redirects and tracking parameters are handled correctly by design.

URL Encoder / Decoder | Base64 Encoder | API Tester | All free tools

Keep reading

More from Pyalm

Oct 16, 2026

How to Format and Validate JSON (and Fix the 6 Most Common Errors)

Why JSON breaks, how to read a validator's error message, and a quick routine for pretty-printing, minifying and fixing JSON from APIs, logs and config files.

Oct 16, 2026

How to Compare Two JSON Files (Without Drowning in Diff Noise)

Text diffs flag reordered keys and whitespace as changes. Here's how a structural JSON comparison works, and how to use it to review API changes, configs and migrations.

Oct 16, 2026

Regex Cheat Sheet with Real Examples (Emails, Phones, Dates, UAE TRN)

A practical regular expression cheat sheet — the syntax you actually use, plus tested patterns for emails, UAE and Indian phone numbers, dates and tax numbers.

Oct 16, 2026

Unix Timestamps Explained: Epoch Time, Seconds vs Milliseconds and Time Zones

What epoch time is, why it's the standard way to store dates, how to tell seconds from milliseconds, and how to avoid the time-zone bugs it causes.

Oct 16, 2026

Minify vs Beautify: What Code Minification Does and When to Use It

How minifying JavaScript, CSS and HTML shrinks files, how much it really saves, and when to beautify minified code to debug it.

Oct 16, 2026

Why You Should Test with Fake Data (and How to Generate It in Seconds)

Using real customer data in development is a privacy risk; using 'test123' hides bugs. Here's how realistic fake data helps — with regional formats for the UAE, India, US and UK.

Try the free URL Encoder / Decoder

Pyalm builds custom software, APIs and integrations for businesses in India and the UAE. We made these developer tools for our own team — use them free, and talk to us when you need something built.

Open URL Encoder / Decoder See website development All free tools