URL Encoder & Decoder

Encode or decode percent-encoded text live — with a cheat table of common escapes. 100% client-side.

encodeURIComponent encodes reserved characters too: / becomes %2F, & becomes %26, # becomes %23. Use it for query-string values.

0 chars

Common URL escapes (percent-encoding cheat sheet)

CharacterEncodedRole in a URL
Space%20form encoding may use +
?%3Fstarts query string
&%26separates parameters
/%2Fpath separator (encoded by encodeURIComponent)
=%3Dkey–value separator
#%23fragment identifier

Quick Answer

URL encoding (percent-encoding) converts characters that are not allowed in URLs — spaces, ampersands, slashes, emoji, and non-ASCII letters — into %XX escape sequences so they can be transmitted safely. Use this free online URL encoder to encode text with encodeURIComponent or encodeURI, or decode any percent-encoded string back to plain text. The conversion is live and two-way, includes a cheat table of common escapes, and runs entirely in your browser — nothing is uploaded.

How It Works

1

Choose Encode or Decode with the toggle at the top of the tool

2

Pick encodeURIComponent for query values, or encodeURI for a whole URL

3

Paste your text — the result updates live in the output box as you type

4

Edit the output directly or click Copy to take the result to your clipboard

Key Facts

  • Live two-way conversion: type in either box and the other updates instantly
  • Toggle between encodeURIComponent (encodes /, ?, &, =, #) and encodeURI (keeps them)
  • encodeURIComponent is for query values; encodeURI is for whole URLs
  • encodeURI leaves / unencoded, so paths stay readable: %2F vs / matters in query values
  • Spaces encode as %20 (standard); form encoding uses + instead
  • Malformed % sequences (like a bare %) are reported inline instead of throwing
  • Handles multi-byte UTF-8 and emoji correctly in both directions
  • 100% client-side: your text never leaves the browser

Frequently Asked Questions

What is the difference between encodeURI and encodeURIComponent?

encodeURI is meant for a complete URL and preserves characters that are part of URL syntax: / ? & = # : and more. encodeURIComponent is meant for an individual value (like a query-string parameter) and encodes almost everything except A–Z a–z 0–9 - _ . ! ~ * ' ( ). So "/" becomes %2F with encodeURIComponent but stays "/" with encodeURI. Use encodeURIComponent for values so reserved characters cannot break the URL structure.

Why is a space sometimes %20 and sometimes +?

The official percent-encoding of a space is %20, which is what both encodeURI and encodeURIComponent produce. The + convention comes from HTML form submissions (application/x-www-form-urlencoded), where spaces are traditionally sent as +. When decoding data that came from a form post, replace + with a space first; when decoding a normal URL, leave + alone because it may be a literal plus sign.

Why does decoding fail with a "malformed URI" error?

decodeURIComponent throws a URIError when it meets a % that is not followed by two valid hexadecimal digits (for example a literal "100% done"), or when a %XX sequence does not form valid UTF-8. This tool catches that error and shows an inline message instead of crashing, so you can spot and fix the bad escape.

How do I encode a query string parameter safely?

Encode each key and each value individually with encodeURIComponent, then join them with = and &: "https://example.com/search?q=" + encodeURIComponent(userInput). Never encode the whole URL with encodeURIComponent — that would turn the : and / separators into %3A and %2F and break it.

Is it safe to paste URLs or text into this tool?

Yes. All encoding and decoding happens locally in your browser using the built-in JavaScript functions. Nothing is sent to a server, logged, or stored — closing the tab discards everything.