URL Encoder / Decoder

Free URL encoder and decoder. Convert special characters to percent-encoded form for use in URLs and query strings, or decode back to readable text.

Quick answer

URL encoding replaces unsafe characters with % followed by their hex code. A space becomes %20 (or +), an ampersand becomes %26, a hash becomes %23. Decoding reverses the process. Use this whenever putting arbitrary text into a query parameter.

URL Encoder / Decoder

How it works

URL encoding (also called percent-encoding) converts special characters to %XX hexadecimal sequences so they survive transmission in URLs. Spaces become %20, ampersands become %26, and so on. Uses the browser's encodeURIComponent and decodeURIComponent.

When to use it

Building query string parameters that contain special characters, debugging encoding issues in API requests, decoding URLs you got from email or chat, or generating Stripe/PayPal redirect URLs.

Common mistakes

Using encodeURI instead of encodeURIComponent when encoding query parameters. encodeURI leaves ?, =, and & alone, which is wrong if those are part of your data. This tool uses the safer component variant.

How URL encoding works

URLs have a defined character set — letters, digits, and a small set of punctuation (-, _, ., ~). Any other character in a URL must be percent-encoded: replaced with a percent sign followed by the two-digit hex value of its UTF-8 byte. Spaces are special — they can be encoded as either '%20' (always safe) or '+' (only safe in query parameters, not in the path). The tool offers both encoding modes plus reserved-character handling for full-string vs. component-only encoding.

When to use it

Constructing URLs that include user input, file names, or international text. Building API queries that take search parameters with special characters. Decoding URLs from logs, redirects, or click tracking to see the actual values. Sanitizing URLs before storing them in a database to ensure consistent format.

Common mistakes

Frequently asked questions

What is URL encoding?

URL encoding (or percent-encoding) replaces characters that aren't safe in URLs with a percent sign followed by their two-digit hex code. A space becomes '%20', an ampersand becomes '%26'. This lets URLs carry arbitrary text — including user input, international characters, and binary data — safely.

Should I encode spaces as %20 or +?

Use '%20' for paths and '+' for query parameters. Both are valid in query strings; only '%20' is valid in the path. When in doubt, use '%20' — it's always safe.

What's the difference between encodeURI and encodeURIComponent?

encodeURI preserves URL structure: it doesn't encode :, /, ?, #, &, or =. Use it on whole URLs. encodeURIComponent encodes everything except letters, digits, and -_.~. Use it on individual values you're putting into a URL — like a search query.