URL Encoder / Decoder
Encode or decode URLs and URL components instantly. Supports both encodeURI (for full URLs) and encodeURIComponent (for query string values).
Common URL Encoded Characters
| Character | Encoded | Description |
|---|---|---|
| %20 | Space | |
| ! | %21 | Exclamation mark |
| " | %22 | Double quote |
| # | %23 | Hash / fragment |
| $ | %24 | Dollar sign |
| % | %25 | Percent sign |
| & | %26 | Ampersand (query separator) |
| ' | %27 | Single quote |
| ( | %28 | Open parenthesis |
| ) | %29 | Close parenthesis |
| + | %2B | Plus sign |
| , | %2C | Comma |
| / | %2F | Forward slash |
| : | %3A | Colon |
| ; | %3B | Semicolon |
| = | %3D | Equals (key=value separator) |
| ? | %3F | Question mark (query start) |
| @ | %40 | At sign |
| [ | %5B | Open bracket |
| ] | %5D | Close bracket |
What is a URL Encoder/Decoder?
A URL encoder/decoder converts text between its human-readable form and percent-encoded (URL-safe) form — transforming characters that have special meaning in URL syntax into escaped representations that can be safely transmitted as part of a web address. URL encoding (officially called percent-encoding, defined in RFC 3986) replaces each unsafe character with a percent sign followed by its two-digit hexadecimal ASCII code: a space becomes %20, an ampersand becomes %26, a hash becomes %23, and a forward slash becomes %2F. The decoder performs the reverse operation — converting %XX sequences back to their original characters — making percent-encoded URLs human-readable again.
The RFC 3986 URI specification divides characters into two classes: unreserved characters (A–Z, a–z, 0–9, hyphen, period, underscore, tilde) that may appear unencoded anywhere in a URL, and reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) that serve as URL syntax delimiters and must be percent-encoded when used as literal data values. A URL query parameter containing a user's search string, for example, must be encoded to prevent the search text from being interpreted as URL structure — a search for "bread & butter" must be encoded as "bread+%26+butter" or "bread%20%26%20butter" to prevent the ampersand from being parsed as a query parameter separator.
Frontend developers use URL encoders when constructing API request URLs with dynamic query parameters, ensuring that user-provided input containing special characters does not break URL parsing. Backend developers use URL decoders to interpret incoming request parameters that browsers automatically encode before submission. JavaScript provides two pairs of encoding functions with different scopes: encodeURIComponent / decodeURIComponent (encodes all characters except unreserved characters — use for query parameter values and path segments) and encodeURI / decodeURI (preserves URL-structural reserved characters — use for complete URL strings). Understanding the distinction prevents double-encoding bugs and broken URL construction in web applications.
How the URL Encoder/Decoder Works
Formula, assumptions, and calculation steps for this dev tools tool.
Formula Used
Replaces reserved or unsafe characters with percent-encoded hex escape sequences per RFC 3986
Methodology
Converts characters unsafe for URLs into percent-encoded hex sequences per RFC 3986, or decodes them back to plain text.
Calculation Steps
- Provide the input text or select generation options.
- Apply the selected encoding, parsing, hashing, or formatting rule.
- Validate the output where possible.
- Return copy-ready developer output.
Assumptions and Limits
- Generated or transformed output depends exactly on the supplied input.
- Security-sensitive values should be handled carefully.
- Browser tools do not replace production validation.
Frequently Asked Questions
URL encoding (also called percent-encoding) converts characters that are not allowed in URLs into a percent sign followed by two hex digits. For example, a space becomes %20. This ensures URLs are valid and can be safely transmitted over the internet.
Use encodeURIComponent when encoding individual query string parameters or URL fragments — it encodes all special characters including & = ? / : etc. Use encodeURI for a full URL — it preserves characters like / : ? & = # that have structural meaning in a URL.
In standard URL percent-encoding (RFC 3986), space encodes to %20. However, HTML form data uses application/x-www-form-urlencoded format where space encodes to +. If you're building query strings from form data, + may appear; in all other cases expect %20.
No. URL encoding (percent-encoding) converts specific characters to %XX hex sequences and is designed for use within URLs. Base64 converts binary data to a text string using 64 ASCII characters and is used for encoding binary data in text contexts like email attachments or data URIs.
Real-World Applications
Common Mistakes
Common Percent-Encoded Characters Quick Reference
| Character | Encoded | URL Role |
|---|---|---|
| Space | %20 (or +) | Not a URL character |
| & | %26 | Query parameter separator |
| = | %3D | Key-value separator |
| # | %23 | Fragment identifier |
| / | %2F | Path segment separator |
References
- Berners-Lee, T. et al. RFC 3986: Uniform Resource Identifier (URI): Generic Syntax. IETF, 2005.
- WHATWG. URL Standard. url.spec.whatwg.org, 2024.
- MDN. encodeURIComponent() — JavaScript Reference. developer.mozilla.org, 2024.
- W3C. HTML5 — URL Percent-Encoding. w3.org, 2024.
- IETF. RFC 1866: Hypertext Markup Language — 2.0 (Form Encoding). ietf.org, 1995.
Related Calculators
Browse all Dev Tools calculators →Base64 Encoder/Decoder
Encode and decode text or files to and from Base64 instantly.
JSON Formatter
Format, validate, minify, and convert JSON to YAML or CSV.
QR Code Generator
Generate QR codes for URLs, text, contact cards, and Wi-Fi credentials.