India · Dubai · Delivering worldwide+91 86603 71224info@pyalm.com
Pyalm Labs logo
Free Tools

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

Nov 27, 2026

Prescription Abbreviations: What OD, BD, TDS, SOS and 1-0-1 Mean

A plain-English list of prescription abbreviations: dose timing (OD, BD, TDS, QID), when to take (AC, PC, HS, SOS), routes, forms, the 1-0-1 dose grid and abbreviations to avoid.

Nov 27, 2026

Handwritten vs Typed Prescriptions: Which Is Safer?

Why legibility matters in prescribing, what changes when clinics move from handwritten to typed or electronic prescriptions, and how to keep a handwritten signature.

Nov 27, 2026

How to Write a Prescription in India: Format and Rules

A practical prescription format for doctors in India: required details, generic names in capitals, the 1-0-1 grid, Schedule H and controlled drugs, and keeping records.

Nov 27, 2026

Prescription Pad Design: Letterhead Template for Clinics

What a professional prescription letterhead should include, paper size, layout, bilingual Arabic and English pads, QR codes for verification and printing tips.

Nov 27, 2026

Prescription Errors: 10 Common Mistakes and How Clinics Prevent Them

The ten prescription mistakes that cause dispensing errors, from illegible names and decimal points to missing durations, and simple fixes for clinics.

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.

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