Percent-encode URLs and query strings, or decode them back. Three modes for the three real-world cases: encoding one piece of a URL, encoding a whole URL while preserving structure, and form-data encoding. Runs entirely in your browser.
encodeURIComponent — for one piece of a URL (a query value, a path segment).
Frequently asked questions
What is URL encoding (and why is it needed)?
URL encoding (also called percent-encoding) replaces unsafe characters in a URL with `%` followed by two hex digits. It's needed because URLs only allow a limited set of characters — spaces, non-ASCII characters, and many punctuation marks must be encoded so the URL remains valid and unambiguous when sent over HTTP.
What's the difference between Component, URI, and Form modes?
Component (encodeURIComponent) is the most common — it encodes EVERY reserved character, so it's safe for one piece of a URL like a query value. URI (encodeURI) leaves URL structure characters (`: / ? # & =`) alone, used when you have a whole URL with correct structure. Form (application/x-www-form-urlencoded) is like Component but spaces become `+` instead of `%20` — used by HTML form POSTs and URLSearchParams.
Is my input sent to a server?
No. The encoding and decoding run entirely in your browser using built-in encodeURIComponent / encodeURI / decodeURIComponent. You can disconnect from the internet and the tool still works. URLs, query strings, and any tokens you paste stay on your machine.
Why does my space sometimes become %20 and sometimes +?
It depends on context. Most of a URL uses `%20` for spaces (Component and URI modes here). The query string of a form POST historically uses `+` for spaces (Form mode), and that's also what HTML <form>s and URLSearchParams produce. Both are technically valid in query strings; servers accept either.
How do I encode characters like /, ?, #, & in a URL?
Use Component mode. encodeURI deliberately leaves those characters alone because they have meaning in a URL (path separator, query start, fragment start, parameter separator). If you need them as literal characters inside one piece of the URL — like a query value containing `&` — Component mode is the right choice.
Does it handle non-ASCII characters like emoji and CJK?
Yes. The browser's encodeURIComponent natively handles UTF-8 — emoji, Japanese, Cyrillic, accented characters all encode correctly. Each non-ASCII character becomes one or more `%XX` sequences representing its UTF-8 bytes.
What if I get 'URI malformed' or 'malformed escape sequence' errors?
That means your input has an incomplete `%` sequence (e.g., `%2` without a second hex digit) or invalid hex characters. Check that every `%` is followed by exactly two hex digits (0–9, A–F). Stray `%` characters in URLs need to be encoded as `%25`.
Is URL encoding the same as HTML encoding?
No. URL encoding uses percent-escapes (`%20`) to make text safe for URLs. HTML encoding uses entity references (`&`, `<`, ` `) to make text safe inside HTML documents. They solve different problems — never substitute one for the other.