URL Encode Online

Percent-encode text for query strings, API calls and redirect URLs, live as you type. Component or full-URI mode. Nothing leaves your browser.

Advertisement

How to URL-encode text

  1. Type or paste your text into the left Plain text box, percent-encoding happens on every keystroke.
  2. Choose the Encoding mode: Component for a single query-string value (escapes everything, including / ? & = #), or Full URI to tidy a whole URL while leaving its structure intact.
  3. Press Copy output to take the encoded string, or Sample to load a messy example with spaces, an &, and an accented email address.
  4. Click ⇄ Swap to run the result back through the decoder and confirm it returns your original text unchanged.

How percent-encoding works

A URL may only contain a limited set of ASCII characters, so any character that is unsafe or reserved is replaced by a % followed by the two-digit hexadecimal value of each byte it occupies. A space is byte 0x20, so coffee & cream becomes coffee%20%26%20cream; the ampersand (0x26) turns into %26 so it can't be mistaken for a parameter separator. Non-ASCII characters are first converted to their UTF-8 bytes and each byte is escaped, which is why café becomes caf%C3%A9, two bytes, two escapes. This tool applies UTF-8 correctly, so emoji and international text encode safely rather than corrupting.

Reserved vs. unreserved characters

The URL standard splits characters into groups. Unreserved characters, A–Z, a–z, 0–9, and - _ . ~, never need escaping and are always left alone. Reserved characters, such as : / ? # [ ] @ ! $ & ' ( ) * + , ; =, carry structural meaning: they delimit the scheme, path, query, and fragment. That distinction is the whole reason there are two modes. Component encoding assumes your text is a value and escapes the reserved characters too, so a stray & or = inside a search term can't split the query string. Full URI encoding assumes you handed it an already-assembled URL and deliberately preserves those reserved characters so the address keeps working.

Frequently asked questions

When do I need to URL-encode text?

Whenever text is placed into a URL and contains spaces, &, ?, =, #, non-ASCII characters or emoji. Left raw, those characters break query strings, corrupt redirect targets, and cause API requests to be parsed wrongly.

Should I use Component or Full-URI mode?

Use Component (encodeURIComponent) when you are inserting a single value into a URL, a search term, a redirect target, an email address in a query, because it escapes the reserved characters / ? & = too. Use Full URI (encodeURI) when you already have a complete URL and only want its spaces and unsafe characters cleaned up without breaking its structure.

Why does a space become %20 (and sometimes +)?

URLs can't contain literal spaces, so a space, byte 0x20, is escaped to %20. HTML forms historically encode spaces in query strings as + instead, which is why you see both conventions; %20 is the safe, universal choice this tool produces.

Why does café become caf%C3%A9 instead of one escape?

Percent-encoding operates on bytes, not characters. The é is two bytes in UTF-8 (0xC3 0xA9), so each byte gets its own escape: %C3%A9. Any character outside ASCII expands to two, three, or four escapes accordingly.

Which characters are left untouched?

The unreserved set: letters, digits, and - _ . ~. These are always safe in a URL and are never escaped in either mode, so a plain word or slug passes through unchanged.

How do I reverse this?

Paste the encoded string into the URL Decode tool, or just hit ⇄ Swap here. Encoding runs entirely in your browser, so URLs holding tokens or session IDs never leave your machine.

Advertisement

More free developer tools