# Free Online URL Encoder and Decoder

> Percent-encode and decode URLs in your browser. Shows the difference between encodeURI and encodeURIComponent, and + versus %20. Free online.

Canonical: https://stayslocal.app/dev/url-encoder-decoder
Last updated: 2026-08-16

Percent-encoding replaces a character with a % and its byte value in hex, so text can survive being part of a URL. Getting it wrong is quiet: the request still goes out, it just carries a query parameter that has been cut in half by an unescaped ampersand.

## Two functions, two different jobs

RFC 3986 divides URL characters into reserved ones that have structural meaning and unreserved ones that never need encoding. encodeURI assumes you are handing it a whole URL, so it leaves the reserved set — : / ? # [ ] @ ! $ & ' ( ) * + , ; = — intact. encodeURIComponent assumes you are handing it one value going inside a URL, so it escapes all of those. Use the component form for a query parameter, the whole-URL form only when you are cleaning up a complete address.

Fields:
- Unreserved: A-Z a-z 0-9 - _ . ~ are never encoded by either function. Everything else is a judgement call.
- encodeURI: Leaves reserved delimiters alone so a full URL stays a URL. Wrong for a value: an & inside it will end the parameter early.
- encodeURIComponent: Escapes & = ? / # and the rest. The right choice for anything you are inserting into a path segment or query value.
- + versus %20: In application/x-www-form-urlencoded bodies a space is +, and a literal plus must be %2B. In a URL path a space is %20 and a + is just a plus — decoding with the wrong rule silently changes the value.
- Encoding: Non-ASCII is UTF-8 first, then percent-escaped per byte, so é is %C3%A9 rather than a single escape.

## How to URL encode and decode online

1. Paste the URL or the value — One whole address, or just the piece you are about to put inside one.
2. Pick component or whole-URL — Component encoding for a parameter value; whole-URL to keep delimiters.
3. Copy it out — Decoding works the same way in reverse, including form-style + handling.

## Where percent-encoding bites

- Building a redirect_uri or callback parameter that contains its own query string.
- Reading a tracking URL to see what was actually passed through it.
- Escaping a search term with spaces and ampersands for a hand-written API call.
- Debugging a webhook URL where a nested URL arrived truncated.

## Questions

**Which should I use, encodeURI or encodeURIComponent?**

Component encoding for any single value going into a URL, which is nearly always the case. Whole-URL encoding only for an address you already consider complete — using it on a value is how an embedded & breaks the query string.

**Does my URL leave the browser?**

No. Encoding and decoding are pure string operations run in this tab. A signed URL or a callback carrying a token is not sent anywhere.

**Why is my space sometimes + and sometimes %20?**

They come from different specs. Form bodies use the HTML form-urlencoded rules where a space is +; URLs proper use %20. A decoder has to be told which one it is looking at, so we make it a choice rather than a guess.

**Can I encode an entire URL safely in one pass?**

No single pass is always right. Encoding a full URL as a component escapes its own slashes and colons; encoding a value as a full URL leaves delimiters that break it. Encode the parts, then assemble.

## Related

- [Base64 Encoder & Decoder](https://stayslocal.app/dev/base64-encoder-decoder): Encode and decode base64 text
- [Developer Tools](https://stayslocal.app/dev): every tool in this family
