URL Encoder & Decoder
Percent-encode and decode URLs online. Handles query strings, path segments, and special characters correctly.
Last updated:
CommentsType text above to percent-encode it for safe use in URLs, or paste an encoded string to decode it back. Auto-updates live.
What is URL Encode/Decode?
URL encoding (also called percent-encoding, RFC 3986) replaces bytes that have special meaning in URLs — like space, `&`, `=`, `?`, `#`, `/` — with `%XX` hex sequences. It's what makes it possible to put arbitrary text into query strings, path segments, and fragments without breaking the URL grammar.
How to URL encode or decode
- 1Choose Encode or Decode at the top.
- 2Paste your text or encoded URL into the input.
- 3The output updates live in the right panel.
- 4Optionally toggle 'encode reserved characters' if you're encoding a full URL vs a single component.
Use Cases
Build safe query strings
Search UIs, filter chips, and shareable URLs need each parameter value URL-encoded to survive special characters.
Debug redirect chains
OAuth `redirect_uri` values, SSO callbacks, and error URLs are often double-encoded. Decode to see the real target.
Compose API requests
Some APIs demand parameters in the path (`/search/{query}`). Encode the query first to avoid breaking on slashes and hashes.
Read email tracking URLs
Marketing links wrap the real destination inside a redirect service. Decode to see where a link actually goes.
Code Examples
URL encoding in JS
// For a full URL: leaves : / ? # alone
encodeURI("https://a.com/path?q=x y");
// For a single component: escapes everything
encodeURIComponent("hello world & friends");URL encoding in Python
from urllib.parse import quote, quote_plus
quote("hello world") # -> "hello%20world"
quote_plus("hello world") # -> "hello+world" (query string style)URL encoding in Go
import "net/url"
url.QueryEscape("hello world") // "hello+world"
url.PathEscape("hello world") // "hello%20world"URL encoding with jq
jq -Rr @uri <<< "hello world" # "hello%20world"Key Concepts
- Reserved characters
- The characters `: / ? # [ ] @ ! $ & ' ( ) * + , ; =` have special meaning. Encode them when they appear inside a value; leave them when they're structural.
- encodeURI vs encodeURIComponent
- `encodeURI` is for a whole URL — it preserves reserved characters. `encodeURIComponent` is for one field's value — it escapes everything except unreserved characters.
- Space: %20 vs +
- In paths, space is `%20`. In query strings, `+` is also accepted (from HTML form encoding, `application/x-www-form-urlencoded`). Servers accept both.
- Double encoding
- Encoding an already-encoded string produces `%2520` (which decodes to `%20`, not space). Almost always a bug. Decode once and check.
Tips & Best Practices
- ▸In code, always use the library — never hand-roll `str.replace(' ', '%20')`. There are dozens of characters to handle.
- ▸Use `encodeURIComponent` for query values and path segments. Use `encodeURI` only when encoding a full URL you assembled yourself.
- ▸If a URL has `%2520` in it, someone encoded twice. Common in ad-tracking and OAuth `state` params.
- ▸Fragments (`#...`) are never sent to the server — they're client-only. Don't rely on them for server-side routing.
Frequently Asked Questions
When should I URL-encode a value?
Whenever a value contains characters that have special meaning in URLs (such as space, &, =, ?, #, /) and is placed in a query string, path, or fragment.
What is the difference between encodeURI and encodeURIComponent?
encodeURI leaves reserved URL characters (:/?#) untouched — use it for full URLs. encodeURIComponent escapes them too — use it for individual query values or path segments. This tool uses encodeURIComponent by default.
Try Next
Base58
Encode and decode Base58 strings online — the alphabet used by Bitcoin addresses, Solana public keys, IPFS CID v0, and Flickr short links. 100% local, no padding, human-safe.
Related Tools
Image → Base64
Convert images to Base64 data URLs online. Drop or select any image and copy the ready-to-paste data URI for CSS, HTML, or JSON.
Base64
Encode and decode Base64 strings online. Supports UTF-8 text and URL-safe Base64. All processing runs locally in your browser.
HTML Encode/Decode
Encode and decode HTML entities (&, <, >, ", numeric references). Useful for sanitizing user content or debugging escaped markup.
ROT13
Apply ROT13 to any text online — a symmetric letter-rotation cipher (rot13(rot13(x)) == x). Also supports ROT-N with custom shift, and ROT47 for full ASCII coverage. Runs 100% locally.
Base64 Image Decoder
Decode Base64 strings back to images. Paste a data:image/... string or raw Base64, and see the decoded image instantly. Useful for debugging data URIs and embedded images. 100% local.
Base32
Encode and decode Base32 strings online (RFC 4648). Handles TOTP / Google Authenticator secrets, DNSSEC records, and other case-insensitive binary-to-text formats. 100% local.