URL Encoder / Decoder
Encode and decode URLs with encodeURIComponent or encodeURI. Parse URL components and query parameters. Free, browser-based.
encodeURIComponent — Encodes all special characters including / ? # & = — use for query string values and individual URL parts.
How it works
- 1Encode tab: paste your text or URL, choose component or full URL mode, copy the encoded result.
- 2Decode tab: paste a URL-encoded string to decode it. Double-encoding is detected automatically.
- 3Parser tab: paste any URL to split it into protocol, host, path, query parameters and hash.
- 4Builder: fill in URL parts to assemble a complete URL with correct encoding.
Frequently asked questions
What Is URL Encoding (Percent Encoding)?
URL encoding, formally called percent encoding, is the process of converting characters that are not allowed or have special meaning in URLs into a safe representation. A URL can only contain a limited set of characters from the ASCII character set. Characters outside this set — including spaces, Unicode characters, and many punctuation marks — must be encoded before they can be included in a URL.
The encoding works by replacing each unsafe character with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII or UTF-8 byte value. A space becomes %20, an at-sign becomes %40, and a forward slash becomes %2F. This allows arbitrary text to be safely transmitted as part of a URL without breaking the URL's structure.
encodeURI vs encodeURIComponent: The Key Difference
JavaScript provides two built-in functions for URL encoding, and choosing the wrong one is a common source of bugs.
encodeURIComponent encodes every character except: letters (A–Z, a–z), digits (0–9), and the characters - _ . ! ~ * ' ( ). It encodes URL structure characters like /, ?, #, &, and =. Use encodeURIComponent for individual query string values and URL path segments where special characters should not be interpreted as URL structure.
encodeURI encodes everything that encodeURIComponent encodes, but it also preserves characters that have structural meaning in a URL: : / ? # [ ] @ ! $ & ' ( ) * + , ; =. Use encodeURI when you want to encode a complete, already-valid URL — you want to make it safe for embedding in another context while preserving its structure.
The practical rule: if you're building a query string value, use encodeURIComponent. If you're encoding a complete URL for inclusion in a link or API parameter, use encodeURI.
Common Characters and Their Encoded Forms
These are the most frequently encountered percent-encoded characters in web development:
%20— space (also written as+in query strings)%2F— forward slash/%3F— question mark?%23— hash/pound sign#%26— ampersand&%3D— equals sign=%2B— plus sign+%40— at sign@%25— percent sign%itself%3A— colon:%2C— comma,
Reading and Parsing Query Strings
Query strings are the part of a URL after the ? character. They consist of key-value pairs separated by &, with keys and values joined by =. All keys and values should be URL-encoded. The URL Parser tab of this tool uses the browser's native URL API to split a URL into all its components and display each query parameter decoded.
In JavaScript, new URL(urlString).searchParams gives you a URLSearchParams object with .get(key), .getAll(key), and .entries() methods. This is the modern, correct way to parse query strings — it handles encoding, duplicate keys, and edge cases that manual string splitting misses. Use our JSON Formatter to inspect the parsed parameters as a JSON object.
URL Length Limits
Despite no formal specification defining a maximum URL length, browsers and servers impose practical limits. Chrome and Firefox support URLs up to approximately 2,083 characters (the Internet Explorer limit that became a de facto standard). Safari supports longer URLs. Most web servers (Apache, Nginx, IIS) default to rejecting request URIs longer than 8,000–16,000 bytes.
URL encoding significantly increases URL length since each encoded byte becomes 3 characters (%XX). A URL with many Unicode query parameters can approach server limits quickly. For long or complex data, prefer POST requests with the data in the body rather than encoding it in the URL.
The Base64 tool can encode binary data for API payloads where the data must travel in a URL-safe format.
Frequently Asked Questions
What is the difference between %20 and + for spaces?
Both represent a space in URLs, but in different contexts. %20 is the correct representation in URL paths. + represents a space only in the query string (application/x-www-form-urlencoded format). When decoding, always use decodeURIComponent for path segments and handle + separately for form data.
Why does my URL have double-encoded characters like %2520?
%25 is the encoding of %. So %2520 is %20 (space) that has itself been encoded again — double-encoding. This happens when code encodes a URL that is already encoded. Our Decode tab detects this and offers a “Decode Again” button.
How do I encode a URL in Python?
Use urllib.parse.quote(string, safe='') for components and urllib.parse.quote(string, safe='/:@?&=') for full URLs. For query strings, use urllib.parse.urlencode(params_dict) which handles the encoding and joins key-value pairs.
What characters are safe in a URL without encoding?
RFC 3986 defines “unreserved characters” that are always safe: letters (A–Z, a–z), digits (0–9), hyphen (-), underscore (_), period (.), and tilde (~). These never need encoding. All other characters should be encoded when used in URL components.
How do I encode a URL for use in a CSS or HTML attribute?
For HTML attributes like href and src, use standard URL encoding and also HTML-encode ampersands: use & instead of & in HTML attributes. Our HTML Entity tool encodes special HTML characters.
Why does my URL break when it contains a #?
# marks the beginning of the fragment (hash) portion of a URL. Everything after # is never sent to the server — it is client-side only. If you need a literal # in a query parameter value, encode it as %23.
What is a canonical URL?
A canonical URL is the preferred, normalized form of a URL. It always uses lowercase, a specific protocol (HTTPS), no trailing slash inconsistencies, and consistently encoded parameters. Use our URL Slug Generator to create clean URL paths.
Keep going
Related Tools
Base64 Encoder / Decoder
Encode text or files to Base64 and decode Base64 strings instantly
HTML Entity Encoder / Decoder
Encode and decode HTML entities, plus a complete entity reference table
UUID Generator
Generate UUID v1, v4 and v7 identifiers in bulk with multiple formats
URL Slug Generator
Convert titles and text into clean SEO-friendly URL slugs
JWT Decoder
Decode and inspect JWT tokens — view header, payload and expiration
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-512 hashes from text or files
CSS Box Shadow Generator
Visually create CSS box shadows with live preview and multi-layer support
Password Generator
Generate strong, random passwords with custom length and character options