URL Encoder / Decoder
Percent-encode or decode any string with encodeURIComponent rules. UTF-8 safe for Chinese, emoji and query strings.
Loading tool…
How It Works
URL encoding — percent encoding — replaces characters that are unsafe in a URI with a percent sign followed by two hex digits, as defined by RFC 3986. Choose Encode and the tool runs your whole input through encodeURIComponent: only the unreserved characters A-Z, a-z, 0-9 and - _ . ! ~ * ' ( ) survive untouched. A space becomes %20, a plus sign becomes %2B, and even the separators of a complete URL (:// ? &) are encoded, which is exactly what you want when a URL travels as a parameter inside another URL.
Multi-byte text is handled through UTF-8 first: 你 is three bytes, so it becomes three triplets (%E4%BD%A0), and a four-byte emoji becomes four. Choose Decode and decodeURIComponent reverses the process — each triplet is read back into a byte and valid UTF-8 sequences are rebuilt into characters, so percent-encoded Chinese and emoji come back intact.
Encoding is not idempotent. Encode an already-encoded string and the percent signs themselves get encoded: %20 becomes %2520. When in doubt about pasted text, decode first, then encode once. Note that JavaScript also offers encodeURI, which deliberately preserves URI structure characters such as : / ? # [ ] @ — convenient for whole URLs, wrong for encoding a value that must not contain separators, which is why this page uses the strict encodeURIComponent. On the way back, a literal plus sign decodes to a plus sign: decode mode never rewrites + into a space. Broken input fails loudly: decoding %ZZ or a truncated sequence like %E4 raises a "Malformed URI component" error instead of quietly dropping the bad bytes, so corrupted query strings surface immediately instead of producing half-decoded text.
How to percent-encode a value
- Select Encode or Decode at the top of the tool.
- Paste only the fragment you want transformed — a parameter value, not a whole address.
- Copy the result from the output panel.
- If the input might already be encoded, decode it first; encoding twice turns %20 into %2520.
Encoding of common characters
| Character | Encoded form | Note |
|---|---|---|
| space | %20 | RFC 3986 form; + is not used for spaces |
| % | %25 | Why double encoding yields %2520 |
| / and ? | %2F and %3F | Separators are encoded in component mode |
| 你 | %E4%BD%A0 | Three UTF-8 bytes, three triplets |
| 👋 | %F0%9F%91%8B | Four-byte emoji round-trips intact |
Examples
Input
hello worldOutput
hello%20worldA space is written as %20 under RFC 3986.
Input
https://example.com/?q=你好Output
https%3A%2F%2Fexample.com%2F%3Fq%3D%E4%BD%A0%E5%A5%BDBoundary: a full URL is encoded component-style — every separator and each UTF-8 byte of 你好 becomes a triplet.
Input
%ZZ (decode mode)Output
Error: Malformed URI componentBoundary: %ZZ is not a valid hex escape, so decoding fails loudly instead of dropping it.
Input
hello%20world (decode mode)Output
hello worldDecode rebuilds the original text from valid percent triplets.
Frequently Asked Questions
- Does it encode the whole URL or only the query string?
- The whole string. The ://, ? and & of a full URL become percent triplets too, because the tool treats your input as one component. Paste only the fragment you want encoded — typically the value of a query parameter.
- Why does a space become %20 and not +?
- RFC 3986, the URI standard this tool follows, specifies %20 for a space. The + convention belongs to HTML form encoding (application/x-www-form-urlencoded); a literal + here is encoded to %2B so it cannot be misread as a space.
- What happens if I encode text twice?
- You get double encoding: the percent sign itself is encoded, so %20 turns into %2520. Decode once before encoding if you are not sure whether input is already percent-encoded.
- Which characters stay readable after encoding?
- The RFC 3986 unreserved set: letters, digits, and - _ . ! ~ * ' ( ). Everything else — spaces, slashes, question marks, non-Latin scripts, emoji — is written as %XX triplets.
Limitations & Accuracy
The whole string is encoded as a single URI component — there is no protocol/host/path split, so encode complete URLs only when they are values inside another URL. Malformed percent escapes (%ZZ, truncated %E4) are hard errors, never partial output. The + sign is always encoded; form-style + for space is not produced or accepted on decode.