/url

URL Encoder & Decoder - Percent Encode URL Strings

Encode or decode query parameters and special characters in URLs using percent encoding.

Uses encodeURIComponent / decodeURIComponent.

How it works

Encode text so it can safely live in a URL, or decode an existing URL back to readable text. If you paste a full address with a query string, it is broken down into a table.

About this tool

URL encoding (called "percent encoding") is how special characters must be represented in a URL so that browsers, servers and everything in between interpret them correctly. Characters like space, `?`, `&`, `#`, `/`, non-ASCII letters and emoji must be converted to `%XX` sequences where `XX` is the character’s byte in hexadecimal. Forget this and you’ll get cryptic errors, a space in a query parameter cuts the URL, an `ø` in a path gives 404. This tool lets you encode and decode strings with the three most common variants: `encodeURIComponent` (most used), `encodeURI` (preserves URL structure), and query-string format (`+` for spaces, used in form posts).

How to use it

  1. Choose mode: "Encode" converts plain text to percent encoding, "Decode" goes the other way.
  2. Pick a variant, `encodeURIComponent` is the default for query values and path segments.
  3. Paste your text, encoding/decoding happens in real time as you type.
  4. On invalid decoding (malformed `%XX` sequence), an error is shown below the output field.
  5. Copy the result with one click. Everything runs locally in the browser.

Examples

Spaces and special chars
Inputhello world & friends?
Outputhello%20world%20%26%20friends%3F
Space becomes `%20`, `&` becomes `%26`, `?` becomes `%3F`. This is required for the parameter to survive in a URL.
Norwegian characters
InputBlåbær-smør
OutputBl%C3%A5b%C3%A6r-sm%C3%B8r
Each accented letter is encoded as two UTF-8 bytes, `å` = `%C3%A5`, `æ` = `%C3%A6`, `ø` = `%C3%B8`. The hyphen (`-`) is "safe" and needs no encoding.
Emoji
Input🚀
Output%F0%9F%9A%80
Emoji live outside the Basic Multilingual Plane and are encoded as 4 UTF-8 bytes.

Common use cases

  • Putting user searches into a URL sent to Google/DuckDuckGo (`?q=…`).
  • Building REST API calls where path segments or query parameters contain special characters.
  • Encoding data for `mailto:` and `tel:` links.
  • Debugging URLs that don’t work, decode to see what’s actually sent.
  • Handling non-ASCII filenames in links and redirects across systems.
  • Passing parameters to third-party widgets (Google Maps, YouTube embed).

Frequently asked questions

What’s the difference between `encodeURI` and `encodeURIComponent`?
`encodeURI` preserves URL structure characters (`: / ? # [ ] @ ! $ & ' ( ) * + , ; =`), use it to encode an entire URL. `encodeURIComponent` encodes all of those too, use it for individual values that will be put into a URL (typically `?key=value`). Wrong choice = broken encode/decode.
Why do I see `+` instead of `%20`?
In legacy HTML forms (`application/x-www-form-urlencoded`), spaces are encoded as `+` instead of `%20`. Both work in the query string, but only `%20` is allowed in the URL path portion. `URLSearchParams` uses `+` by default.
Do I need to encode non-ASCII characters in URLs?
Yes, technically all non-ASCII characters should be encoded. Modern browsers display decoded characters in the address bar for readability but encode them before sending. The server and backend must decode from UTF-8, this usually works automatically. Errors usually arise from using latin-1 or the wrong charset.
Can I accidentally double-encode?
Yes, and it’s a common source of bugs. If you encode `hello%20world` again, it becomes `hello%2520world` (since `%` becomes `%25`). Watch for `%25` in output, it’s almost always the sign of double encoding. Decode the string first if you’re unsure whether it’s already encoded.

Technical background

Percent encoding is defined in RFC 3986. "Reserved" characters have special meaning in URL syntax and must be encoded when used literally in a value. "Unreserved" characters (letters, digits, `-`, `.`, `_`, `~`) never need encoding. All other bytes (including all UTF-8 multi-byte sequences) must be encoded as `%XX`. JavaScript’s `encodeURI` leaves 82 characters unencoded that are legal in a URL, while `encodeURIComponent` leaves only 71 (encoding reserved characters too).