LazyTools

🔒 Every tool runs in your browser — the files and values you enter are never uploaded to any server. How it works

🔗 URL Encoder / Decoder

Spaces become %20, & becomes %26 — encode text safely into URLs, or decode percent-encoding back to readable text.

encodeURIComponent — safe for query values

Rate this tool:
Anonymous — no account, no identifier

How the url encoder / decoder works

Percent-encoding replaces unsafe bytes with %XX hex escapes per RFC 3986. The crucial choice is scope: component mode (encodeURIComponent) escapes everything including /, ?, & and = — right for a single query-string value; whole-URI mode (encodeURI) preserves those structural characters — right for encoding a complete URL. Decoding also converts + to space, the historical form-encoding convention.

The classic bug this tool prevents: putting an unencoded & inside a query value ("Tom & Jerry") and silently truncating the parameter at the ampersand. Encode values in component mode before assembling the URL, not after.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?

Scope. encodeURIComponent escapes everything unsafe including /?&=# — use it on individual values. encodeURI leaves URL structure intact — use it only on a complete URL. Wrong choice in either direction is the top URL-encoding bug.

Why does a space become %20 sometimes and + other times?

Two conventions: %20 is the RFC 3986 standard everywhere in URLs; + means space only in the query string under the older form-encoding rules. This decoder accepts both.

Do I need to encode Unicode like é or 中?

Yes for maximum compatibility — they become their UTF-8 bytes percent-encoded (é → %C3%A9). Browsers often display the decoded form, but the wire format is encoded.

Why did decoding fail with "malformed"?

A % not followed by two hex digits — usually a raw % sign in text that was never meant as encoding. Encode the raw text first, or fix the stray %.

Is my URL data kept private?

Yes — URLs often contain tokens and IDs, and this tool never transmits them; everything runs locally.

Related developer tools

From the blog