URL Encoder / Decoder Widget
Add a URL encoder and decoder to your web development pages. Readers choose between encoding a single query value, a strict RFC 3986 value or a whole URL, and a broken % sequence is located precisely.
Live preview
Exactly what your visitors will seeUnder the widget on your page: Powered by A2Z Tools
Embed code
<iframe src="https://a2z.tools/embed/w/url-encoder" title="URL Encoder / Decoder by A2Z Tools" width="100%" height="570" style="border:0;width:100%" loading="lazy" allow="clipboard-write"></iframe>
A plain iframe. Works everywhere, including site builders that strip scripts. Adjust height if your content needs more room.
<div data-a2z-widget="url-encoder" data-height="570"></div> <script async src="https://a2z.tools/embed.js"></script>
Adds a small script (what it does) that sizes the widget to fit its content, loads it lazily and keeps it isolated from your page's CSS.
Works with
How it works
Component mode is JavaScript's encodeURIComponent, the right choice for one query-string value or path segment: it escapes everything except letters, digits and - _ . ! ~ * ' ( ). Strict mode also escapes ! ' ( ) * because RFC 3986 reserves them. Full-URL mode is encodeURI, which leaves the URL's structure (: / ? # & =) intact and only escapes spaces and characters outside ASCII. Text is encoded as UTF-8, so é becomes %C3%A9. When decoding fails the widget does not stop at "URI malformed" - it reports whether a % is not followed by two hex digits or whether the bytes do not form valid UTF-8, and at which character.
Method
- Component: encodeURIComponent (unreserved A-Z a-z 0-9 - _ . ! ~ * ' ( ) kept)
- Strict: as component, plus ! ' ( ) * escaped (RFC 3986 section 2.2)
- Full URL: encodeURI (reserved : / ? # [ ] @ ! $ & ' ( ) * + , ; = kept)
- Form encoding option: space <-> + (application/x-www-form-urlencoded)
Limitations
- It does not parse a URL into scheme, host, path and query, and does not convert international domain names to Punycode.
- It cannot tell whether text is already encoded: encoding a%20b again gives a%2520b, so decode first when unsure.
- Text is always treated as UTF-8; legacy Latin-1 escapes such as %E9 decode as an error, not as the letter é.
Where publishers use it
- Guides on building query strings for REST APIs
- UTM and campaign-link tutorials for marketers
- Debugging redirects and OAuth callback URLs in developer docs
- Teaching pages that explain percent-encoding and UTF-8
Questions
Which mode should I use?
Use Component for a single value you place after = in a query string. Use Full URL only for a complete address you want to keep working as a link.
Should spaces be %20 or +?
In URLs a space is %20. The + form is only valid in HTML form submissions (application/x-www-form-urlencoded); switch the option on when you are dealing with form data.
What does "not valid UTF-8" mean?
The %XX bytes decode to something that is not a UTF-8 character, often because text was encoded in Latin-1 or cut in the middle of a multi-byte character.
Does the widget open the URL?
No. It only transforms the text; nothing is requested.
Sources
- RFC 3986: Uniform Resource Identifier (URI): Generic Syntax - IETF . Section 2.1 percent-encoding, 2.2 reserved and 2.3 unreserved characters
- URL Standard: application/x-www-form-urlencoded - WHATWG . Space as + in HTML form data
- ECMAScript: encodeURIComponent and encodeURI - Ecma International (TC39) . Exact character sets kept by component and full-URL modes
Cite or recommend this tool
If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.
A2Z Tools URL Encoder / Decoder https://a2z.tools/embed/url-encoder
<a href="https://a2z.tools/embed/url-encoder">A2Z Tools URL Encoder / Decoder</a>
[A2Z Tools URL Encoder / Decoder](https://a2z.tools/embed/url-encoder)
URL Encoder / Decoder by A2Z Tools - https://a2z.tools/embed/url-encoder
Related widgets
-
Encode text to Base64 or decode it, with proper UTF-8 and an optional URL-safe alphabet.
-
Turn a title into a clean URL slug: accents transliterated, optional stop-word removal and length cap.
-
Pretty-print, minify or validate JSON, with the line and column of the first syntax error.
-
Convert a JSON array of objects to CSV and CSV back to JSON, with RFC 4180 quoting.
-
Read a JSON Web Token's header and claims, with exp, nbf and iat shown as dates.
-
Generate 1 to 100 random v4 or time-ordered v7 UUIDs in several formats.