How to URL Encode Special Characters

Spaces, ampersands, and special characters break URLs. URL encoding converts them to safe percent-encoded format so your links and API calls actually work.

Open URL Encoder / Decoder 100% free. No sign-up. Works in your browser.

Quick Answer

Paste any text into the URL encoder at dotsapps.com to convert special characters to percent-encoded format (%20, %26, etc.). Switch to decode mode to convert encoded URLs back to readable text.

Why URLs Need Encoding

URLs can only contain a limited set of characters safely. Letters, numbers, hyphens, underscores, dots, and tildes are fine. Everything else — spaces, quotes, ampersands, non-English characters — must be encoded.

Without encoding, a space in a URL breaks the link. An ampersand confuses the query string parser. A question mark starts a new query when you didn't want one.

URL encoding (also called percent encoding) replaces unsafe characters with a % followed by two hex digits. A space becomes %20. An ampersand becomes %26. A plus sign becomes %2B.

Common Characters That Need URL Encoding

Here are the characters you'll encode most often:

  • Space%20 (or + in form data)
  • &%26 — Separates query parameters, so literal ampersands must be encoded
  • =%3D — Separates key-value pairs in query strings
  • ?%3F — Starts the query string, encode if used in a value
  • #%23 — Starts a fragment identifier
  • /%2F — Path separator, encode if used in a value
  • @%40 — Used in email-style URLs

Non-ASCII characters like accented letters (é, ü) or emoji are first converted to UTF-8 bytes, then each byte is percent-encoded. The letter é becomes %C3%A9.

When to Encode vs When to Decode

Encode when you're building URLs in code. Any user input going into a URL query parameter needs encoding. If you're constructing API requests, encode parameter values to prevent injection and parsing errors.

Decode when you receive an encoded URL and need to read it. Browser address bars often show decoded URLs, but if you're reading logs, API responses, or redirect URLs, you'll see the encoded version.

A common mistake is double-encoding. If you encode a URL that's already encoded, %20 becomes %2520. Always decode first if you're not sure whether the input is already encoded.

URL Encoding in Code

After verifying the correct encoding in the online tool, use these functions in your code:

JavaScript: Use encodeURIComponent() for query parameter values. Use encodeURI() for complete URLs (it preserves URL-special characters like / and ?).

Python: urllib.parse.quote(text) for path segments, urllib.parse.urlencode(params) for query parameters.

Important: Don't encode the entire URL at once. Encode each parameter value separately, then assemble the URL. Encoding the whole URL would break the ://, /, ?, and & characters that give the URL its structure.

How to Do It: Step-by-Step

  1. 1

    Open the URL Encode/Decode tool at dotsapps.com

  2. 2

    Choose Encode or Decode mode

  3. 3

    Paste your text or encoded URL string

  4. 4

    The converted output appears instantly

  5. 5

    Copy the result and use it in your URL or code

Try URL Encoder / Decoder Now →

Frequently Asked Questions

What is the difference between %20 and + for spaces?

Both represent a space, but in different contexts. %20 is used in URL paths and is the standard percent-encoding. The + sign represents a space only in form data (application/x-www-form-urlencoded). Use %20 in most cases.

Should I encode the entire URL or just the parameters?

Only encode parameter values, not the entire URL. Characters like ://?&= are structural parts of the URL. If you encode them, the URL breaks. Encode each parameter value separately.

What is double encoding and how do I avoid it?

Double encoding happens when you encode a string that's already encoded. The % in %20 becomes %25, turning %20 into %2520. To avoid this, check if your input is already encoded before encoding it.

How do I URL encode non-English characters?

Non-ASCII characters are first converted to their UTF-8 byte sequence, then each byte is percent-encoded. For example, the Japanese character あ becomes %E3%81%82. The online encoder handles this automatically.

Is URL encoding the same as HTML encoding?

No. URL encoding uses percent signs (%20 for space). HTML encoding uses ampersand codes (  for space, & for ampersand). They serve different purposes and are not interchangeable.

Ready to Try It?

URL Encoder / Decoder is free, private, and works right in your browser. No sign-up needed.

Open URL Encoder / Decoder

Related Tools You Might Like

Cloud Sync

Connected to Google Drive