URL Encoder & Decoder
Percent-encode and decode URL components or whole URLs, with a clear explanation of when to use which.
How to use the URL Encoder & Decoder
- Choose Encode or Decode.
- Choose “URL component” for a single value (a query parameter, a path segment) or “Complete URL” for a whole address.
- Type or paste into the input. The result appears immediately and malformed input shows an error.
- Copy the result, or use “Use result as input” to reverse it. For complete URLs, a breakdown of the host, path and query parameters is shown.
Good to know
- “URL component” uses encodeURIComponent/decodeURIComponent. “Complete URL” uses encodeURI/decodeURI, which leave reserved characters such as : / ? # & = untouched. Decoding a complete URL therefore does not turn %2F or %26 back into / or &.
- Non-ASCII characters are encoded as their UTF-8 bytes, for example é becomes %C3%A9.
- The “+ for spaces” option switches to application/x-www-form-urlencoded style, used by HTML form submissions. In a normal URL path, a + is a literal plus sign.
- A text containing a lone surrogate (a broken emoji) cannot be encoded and reports an error. Input is limited to 500,000 characters.
Examples
- Encode a query value
- a&b=c d (URL component) → a%26b%3Dc%20d The & and = no longer look like parameter separators.
- Encode a whole URL
- https://example.com/café menu?q=1 (Complete URL) → https://example.com/caf%C3%A9%20menu?q=1 The :, /, ? and = are kept so the URL still works.
- Spot a bad sequence
- 100% sure → Error: a “%” must be followed by two hexadecimal digits (position 4).
Frequently asked questions
When should I use encodeURI instead of encodeURIComponent?
Use Complete URL when you have a full address that only needs unsafe characters such as spaces fixed. Use URL component for any piece you insert into a URL, because it also escapes the characters that give a URL its structure.
Why does decoding fail with “Malformed percent-encoding”?
A “%” in a URL must be followed by two hex digits (for example %20). A literal percent sign should itself be written as %25.
Is this the same as HTML entity escaping?
No. URL percent-encoding (%20) and HTML entities (&) are different mechanisms for different contexts.
Related free tools
- SEO & Marketing
UTM Link Builder
Add campaign source, medium, name, term and content to any URL while keeping its existing parameters.
Use tool - Developer Tools
Base64 Encoder & Decoder
Encode and decode Base64 text with full Unicode support, URL-safe output and file-to-Base64 conversion.
Use tool - SEO & Marketing
Meta Tag Generator
Build title, description, canonical, robots, Open Graph and Twitter Card tags with a live search and social preview.
Use tool
Need Something Built For Your Business?
aimEncoders designs and builds custom software, websites and internal tools, backed by automated QA.
- Reply within 1 business day
- Fixed quote, no surprise invoices
- You own 100% of the code
Free discovery call • Straight to a developer • Strict NDA available