URL Encode / Decode

Encode or decode percent-encoding (encodeURIComponent-style): spaces, Unicode, and query-string characters. Catch double-encoding (%2520) before you paste a parameter into an API.

Input data

Results

Enter data and click Calculate.

What URL encoding (percent-encoding) means

A URL can safely carry a limited ASCII set. Everything else β€” spaces, non-ASCII letters, reserved symbols β€” is written as percent-encoding: % plus two hex digits (a UTF-8 byte or other, depending on context). Example: space β†’ %20, Γ© in UTF-8 β†’ %C3%A9.

This calculator follows semantics close to JavaScript encodeURIComponent / decodeURIComponent: it encodes characters that are unsafe in a URI component (parameter value, path segment), and decodes %HH sequences back to text.

Which characters usually need encoding

  • URI reserved: :/?#[]@!$&'()*+,;= β€” inside a parameter value they often must be encoded or they change URL structure.
  • Spaces and controls β€” always encode in query/path components.
  • Unicode (accents, €, emoji) β€” as UTF-8 percent-encoded byte sequences.
  • Typically safe in encodeURIComponent: A–Z a–z, digits, - _ . ! ~ * ' ( ) β€” details vary by API; do not assume identity with encodeURI.

Space: %20 vs plus (+)

  • %20 β€” universal percent-encoding for space (path, query, most APIs).
  • + β€” in application/x-www-form-urlencoded (classic HTML forms), space is often a plus in the query string.
  • encodeURIComponent('a b') β†’ a%20b (not plus). Treating bare + as space is a form-encoding rule, not plain URI-component decoding.

If an API expects form-urlencoded, read the docs β€” mixing %20 and + is a common integration bug.

Encoding vs decoding

  • Encode β€” user text / parameter β†’ safe URL fragment.
  • Decode β€” %HH from logs, OAuth callbacks, copy-paste β†’ readable text.
  • Encoding is not encryption: anyone can decode it. It does not protect secrets.
  • Invalid % sequences (e.g. %ZZ, truncated %C3) fail decoding β€” the calculator reports that.

Path vs query string

  • Query (?q=...) β€” encode each value with a component encoder, then join pairs with & / =.
  • Path β€” keep structural slashes; encode odd characters inside segments. encodeURI (whole URL) preserves more reserved characters than encodeURIComponent.
  • Fragment (#...) β€” do not encode the opening #; encode fragment content as your app requires.

Bad practice: run encodeURIComponent on a full https:// URL for the address bar β€” you get a useless blob (unless you intentionally pass a URL as a parameter value).

Common mistakes and double-encoding

  • Double-encode: a b β†’ a%20b β†’ again β†’ a%2520b. Symptom in logs: %25.
  • Encoding an already-built query including & β€” breaks parameter structure.
  • Decoding β€œjust in case” repeatedly β€” can corrupt data that legally contains %.
  • Confusing Base64 with percent-encoding β€” different alphabets and purposes.
  • Copying UI pluses into a context that expects %20.

Worked examples

  • hello world β†’ hello%20world
  • a&b=c (as a value) β†’ a%26b%3Dc
  • cafΓ© β†’ caf%C3%A9 (UTF-8)
  • 100% sure β†’ 100%25%20sure (% must be encoded too)
  • Decode a%2520b once β†’ a%20b; twice β†’ a b (undoing double-encode on purpose)

Paste your own string into the form β€” copy the result into an HTTP request or API docs.

Quick encoding table (encodeURIComponent)

Common characters and strings β€” semantics close to encodeURIComponent in this calculator.

InputEncodedNote
space%20not plus (+) as in form-urlencoded
@%40common in emails inside query values
/%2Finside a parameter value, not as a path separator
?%3Fotherwise starts a new query
hello worldhello%20worldsimple smoke test
email@example.comemail%40example.comwhole address as a value

Safe URL-building workflow

  • Build the base URL with fixed parts (https://api.example.com/v1/search).
  • Encode each parameter value separately (this calculator / encodeURIComponent).
  • Join ?k= + encoded + & + more pairs β€” do not encode the finished query a second time.
  • When debugging: if logs show %2520, decode once and find which layer over-encodes (frontend, gateway, SDK).
  • Regression tests: space, &, %, emoji, empty string, already-encoded input.

Full query example: search phrase shoes & bags β†’ value shoes%20%26%20bags β†’ URL .../search?q=shoes%20%26%20bags.

FAQ β€” percent-encoding, spaces, and double-encode

Quick answers for building query strings and debugging %2520.

encodeURI vs encodeURIComponent?
encodeURI protects a full URL and leaves characters like :/?#. encodeURIComponent encodes more aggressively β€” for parameter values. This calculator targets component semantics.
Is space %20 or +?
In a URI component, usually %20. Plus is typical for form-urlencoded. Do not mix the rules.
How do I spot double-encoding?
Look for %25 (an encoded %). e.g. %2520 is a space encoded twice.
Can I encode a full https:// address?
Only when that address is a *value* of another parameter. The browser bar needs a structured URL, not a fully percent-encoded blob.
Why do non-ASCII characters become many %HH?
UTF-8 encodes them as 2+ bytes; each byte becomes its own %HH.
Decode throws β€” what should I check?
Truncated % sequences, non-hex digits, or text that was never percent-encoded.
Does encoding stop XSS/SQLi?
Not by itself. It is URI transport, not input validation. The app must still escape for HTML/SQL context.
When should the backend decode?
Frameworks often decode query strings for you. Do not decode a second time β€œjust in case” β€” that causes double-decode bugs.