Free URL Encoder / Decoder
Encode special characters for use in URLs, or decode percent-encoded strings. Perfect for building QR code content.
Encode URL
Decode URL
What is URL Encoding?
URL encoding (also called percent-encoding) replaces special characters with a % followed by their hexadecimal ASCII value. This ensures URLs are transmitted correctly, since many characters have special meaning in URLs.
encodeURIComponent vs encodeURI
- encodeURIComponent — encodes everything except
A-Z a-z 0-9 - _ . ~ ! * ' ( ). Use for query parameter values. - encodeURI — preserves URL structure characters like
: / ? # [ ] @ ! $ & ' ( ) * + , ; =. Use for complete URLs.
Common Encoded Characters
| Character | Encoded | Description |
|---|---|---|
| (space) | %20 | Space character |
| & | %26 | Ampersand |
| = | %3D | Equals sign |
| ? | %3F | Question mark |
| # | %23 | Hash / fragment |
| / | %2F | Forward slash |
Frequently Asked Questions
What is the difference between encodeURIComponent and encodeURI?
They protect different things. encodeURIComponent escapes almost everything that is not a letter, digit or one of a few safe marks, so it is what you use for a single piece of data going into a query parameter. encodeURI leaves the structural characters of a URL alone — the slashes, the question mark, the ampersand — because it is meant for escaping a whole address you have already assembled. Using encodeURI on a parameter value is the classic bug: an ampersand inside the value survives, and the server reads it as the start of a new parameter.
Why do spaces sometimes become %20 and sometimes a plus sign?
Both appear in real URLs, but they come from different rules. Percent-encoding, defined in RFC 3986, always writes a space as %20. The plus sign comes from the older HTML form encoding, application/x-www-form-urlencoded, which is still what browsers use when they submit a form by GET. A plus is only a space inside a query string under that rule; in a path segment it is a literal plus. When in doubt, %20 is correct everywhere.
Do I need to encode a URL before putting it in a QR code?
Not for the QR code's sake. QR codes carry bytes and are perfectly happy with any character, including spaces and non-Latin scripts. You encode for the benefit of whatever opens the link afterwards. If the URL contains a space, an ampersand or a hash inside a parameter value, encode that value or the receiving application will misread the address.
Which characters actually need encoding?
The reserved ones, when they appear as data rather than as structure: question mark, ampersand, equals, hash, slash, plus, percent, colon, semicolon, comma, at sign, and space. Everything outside the ASCII range must be encoded too, as UTF-8 bytes. Unreserved characters — letters, digits, hyphen, full stop, underscore and tilde — never need it, and encoding them anyway is legal but pointless.
Why did my decoded text come out as strange symbols?
Almost always a character-set mismatch. Percent-encoding represents bytes, not characters, so a string encoded as UTF-8 and decoded as something else produces mojibake — the familiar é in place of é. This tool encodes and decodes as UTF-8, which is what RFC 3986 recommends and what every modern system expects.
Can I decode a string that was encoded more than once?
Yes, by decoding repeatedly until the output stops changing. Double encoding happens when a value passes through two layers that each escape it, and you can spot it by the %25 sequences: %2520 is a double-encoded space, because the percent sign of %20 was itself encoded. It is worth fixing at the source rather than decoding twice forever.
Is percent-encoding a form of security?
No. It is a transport convention, not a protection. Encoding does not hide anything — it is trivially reversible, which is the whole point — and it does not sanitise input. Anything that matters for security has to be validated after decoding, on the server, against what the value is actually allowed to be.
Is anything I paste here uploaded?
No. The encoding and decoding run as plain JavaScript in your browser, with no network requests and nothing stored. Nothing you paste leaves the page, which matters when the string you are debugging contains a token or a customer identifier.
Scan QR Codes with Encoded URLs
The Scan & Generate app automatically handles encoded URLs in QR codes, opening links and decoding content with a single tap.