URL Encoder / Decoder

Percent-encode or decode URLs and query values — component or full-URL mode, batch lines, copy.

Free online URL encoder and decoder. Percent-encode or decode text with encodeURIComponent or encodeURI, process many lines at once in batch mode, and copy the result. Runs entirely in your browser — nothing is uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is the difference between encodeURIComponent and encodeURI?

encodeURIComponent escapes almost every reserved character, so it is correct for a single query value or path segment. encodeURI leaves the characters that build a URL — : / ? & # = — unescaped, so it is for encoding a whole URL you do not want to break. Use Component mode for values, Full URL mode for complete links.

Embed this tool

Drop this free tool into your own site or blog. It runs entirely in your visitor's browser — nothing is sent to us.

<iframe src="https://geratools.com/embed/url-encoder-decoder" width="100%" height="600" style="border:1px solid #e5e7eb;border-radius:8px" title="URL Encoder / Decoder — GeraTools" loading="lazy"></iframe>

A fast, no-nonsense URL encoder and decoder for developers. Paste any text, URL, or list of values and convert it to or from percent-encoding instantly. Choose between component mode (encodeURIComponent, which escapes almost everything) and full-URL mode (encodeURI, which keeps the URL structure intact), switch between encoding and decoding with one dropdown, and process dozens of lines at once in batch mode. Every result has a one-click copy button, and a Swap action round-trips the output back into the input so you can verify a conversion both ways.

Percent-encoding, round trip

Percent-encoding replaces unsafe or reserved characters with a % followed by two hexadecimal digits — a space becomes %20, an ampersand becomes %26, and so on. This is how URLs carry spaces, unicode, and special characters without breaking. The tool uses the browser’s own four standard functions, so the output matches exactly what your JavaScript runtime, server, and HTTP client will produce.

The key decision is which characters to escape. Component mode calls encodeURIComponent, escaping every reserved character including : / ? & # =. That is what you want for a single query-string value or path segment, because those characters would otherwise be interpreted as URL structure. Full-URL mode calls encodeURI, which leaves the structural characters alone so a complete link such as https://site.com/a b?x=1 stays a valid, working URL with only the space encoded. Decoding reverses the process with decodeURIComponent and decodeURI; a malformed escape (a lone %, or %zz) raises a URIError, and the tool flags that line rather than silently corrupting your data.

Example

Type the value hello world & café into the input with Encode and Component selected. The output is hello%20world%20%26%20caf%C3%A9 — the space, ampersand, and accented é are all escaped, so the string is safe to drop straight into a query parameter. Switch the scheme to Full URL on the link https://gera.tools/a b?q=1&r=2 and only the space changes, to https://gera.tools/a%20b?q=1&r=2, leaving the ?, &, and = untouched so the URL still parses.

Flip the direction to Decode, paste caf%C3%A9%20au%20lait, and you get back café au lait. Turn on batch mode, drop several encoded strings one per line, and each is decoded independently with a per-line breakdown table showing input next to output. Everything is computed in your browser — nothing you paste ever leaves your device.

What actually happens to non-ASCII text

Percent-encoding is byte-based: characters outside the unreserved ASCII set are first serialised to UTF-8 bytes, then each byte becomes %XX. A character like é (U+00E9) encodes to two bytes, %C3%A9; a CJK character takes three; an emoji four. This is defined by RFC 3986 together with the UTF-8 convention, and it is why decoded output can look “longer” than its encoded form suggests, and why decoding with the wrong charset assumption (an old system expecting Latin-1) produces mojibake like é. JavaScript’s encodeURIComponent/decodeURIComponent — the functions this tool wraps, documented on MDN — always use UTF-8, matching every modern browser and server default.

Decoding safely: three habits

  • Decode once, then look again. If the output still contains %XX sequences, the input was double-encoded upstream; decode again only if you know that is the case, not on a loop.
  • Expect + from form data. Query strings produced by HTML forms represent spaces as +; convert them to spaces (or to %20) before decoding if your source is a form submission.
  • Malformed sequences throw. A stray % not followed by two hex digits makes decodeURIComponent raise a URIError — this tool surfaces that as an error message rather than silently returning half-decoded text, because a truncated URL is usually the real culprit (a link cut off mid-percent-sequence by an email client or character limit).

A worked round trip

Take the query value Fish & Chips: 50% off?. Encoded for safe transport it becomes Fish%20%26%20Chips%3A%2050%25%20off%3F — the ampersand, colon, percent and question mark each replaced so they cannot be mistaken for URL structure. Decoding reverses it byte for byte. Delete the trailing %3F and decode again and you get the same text minus the question mark — but delete only the F and the dangling %3 makes the whole decode throw, which is exactly the truncated-link failure described above and the reason this tool reports the error position instead of guessing.