What is URL encoding (percent-encoding)?
URL encoding converts characters that have special meaning in URLs — spaces, ampersands, question marks, equal signs — into a safe %XX format using two hexadecimal digits. A space becomes %20, an ampersand becomes %26. This prevents browsers and servers from misinterpreting data as URL syntax. It is required whenever you put arbitrary text into a query string, path segment, or form submission.
How to use this tool
- 1 Choose Encode to convert raw text to a URL-safe percent-encoded string, or Decode to reverse it.
- 2 Paste your text or URL into the Input box — the result updates instantly as you type.
- 3 Use the Swap button to flip the output back into the input field when you want to decode what you just encoded.
- 4 Click the copy icon on the Output header to grab the result with one click.
Frequently asked questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URL, leaving characters like / : ? & = # untouched because they are part of URL structure. encodeURIComponent encodes a value that goes inside a URL — a query param or path segment — so it also encodes / ? & = #. This tool uses encodeURIComponent, which is almost always what you need when encoding individual values.
Why does a space sometimes become + and sometimes %20?
HTML form submissions (application/x-www-form-urlencoded) encode spaces as +. Standard percent-encoding uses %20. When writing a URL by hand or encoding a query value in code, %20 is correct. This tool uses %20.
Is my data sent to a server?
No. Encoding and decoding both run locally using the browser's native encodeURIComponent and decodeURIComponent functions. Nothing you type leaves your machine.
What characters are NOT encoded?
Letters (A-Z, a-z), digits (0-9), and the unreserved characters - _ . ! ~ * ' ( ) are left as-is because they are safe in any URL context. Everything else — including spaces, slashes, brackets, and Unicode — is percent-encoded.
I get a 'malformed URI' error when decoding — why?
The input contains a percent sign that is not followed by two valid hex digits (e.g. %GH or a lone %). Either the string was not properly encoded to begin with, or it got truncated. Fix the broken sequence and try again.