๐Ÿ”— Encode ยท Decode ยท Query Parser ยท RFC 3986

URL Encode / Decode

Instantly encode or decode URLs, query strings, and special characters. Supports encodeURIComponent, encodeURI, and full query string parsing with a character reference table.

url-encode-decode โ€” primecalculator.net
Input (plain text / URL)
Output (encoded)
Function:
Input Length
0
Output Length
0
%XX Sequences
0
Size Change
โ€”
โš™ Query String Parser Paste a full URL to extract & decode all query parameters
Paste a URL with query parameters above and click Parse
๐Ÿ“‹ Common URL Encodings โ€” Click to copy code
Click any row to copy the %XX code to clipboard

What Is URL Encoding and Why Is It Needed?

URL encoding (also called percent-encoding) is the process of converting characters in a URL that are not allowed in plain ASCII, or that have special meanings in URLs, into a format that can be safely transmitted over the internet. Each character is replaced by a percent sign (%) followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20, and the # character becomes %23. URL encoding is defined by RFC 3986. For other encoding tools, see our Conversion Calculator.

Why URLs Need Encoding

URLs can only contain a limited set of ASCII characters. Characters outside this set โ€” including spaces, Unicode characters (like รฉ, รฑ, ไธญ), and reserved characters that have structural meaning in URLs (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) โ€” must be percent-encoded when used as data. Without encoding, a space in a URL parameter would break the URL structure, a # would be interpreted as a fragment identifier, and a & would be interpreted as a query string separator.

encodeURIComponent vs encodeURI

encodeURIComponent()

Encodes everything except letters, digits, and - _ . ! ~ * ' ( ). Encodes reserved URL characters like : / ? # & =. Use this for individual parameter values inside a query string.

Input: hello world/test?id=1
Output: hello%20world%2Ftest%3Fid%3D1

encodeURI()

Encodes everything except letters, digits, - _ . ! ~ * ' ( ), and reserved URL characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =). Use this for complete URLs to fix non-ASCII characters while preserving URL structure.

Input: https://example.com/hรฉllo
Output: https://example.com/h%C3%A9llo

How URL Encoding Works โ€” The Algorithm

Percent-Encoding Process (RFC 3986)
1. Convert character to UTF-8 byte sequence 2. Each byte โ†’ % + two uppercase hex digits 3. Example: Space (U+0020) โ†’ UTF-8: 0x20 โ†’ %20 4. Example: รฉ (U+00E9) โ†’ UTF-8: 0xC3 0xA9 โ†’ %C3%A9 5. Example: ไธญ (U+4E2D) โ†’ UTF-8: 0xE4 0xB8 0xAD โ†’ %E4%B8%AD

Note: + in query strings (application/x-www-form-urlencoded) represents a space. Use %20 for spaces in path segments.

Common URL Encoding Mistakes

Double encoding is the most common mistake โ€” encoding an already-encoded URL results in %20 becoming %2520 (the % itself gets encoded as %25). Always decode before re-encoding. Using + for spaces in paths is incorrect โ€” + as space applies only to form-encoded query strings (HTML forms), not URL path segments. In path segments, spaces must be %20. Not encoding Unicode โ€” browsers display international characters in address bars for readability, but the actual transmitted URL must be UTF-8 percent-encoded. For more developer tools, try our IP Subnet Calculator and Password Generator.

Frequently Asked Questions

Common questions about URL encoding, decoding, and percent-encoding

%20 is the percent-encoded representation of a space character. In URL encoding (RFC 3986), spaces are not allowed directly in URLs, so they are replaced with %20. The % indicates percent-encoding, and 20 is the hexadecimal value of the ASCII/UTF-8 code for space (32 in decimal = 0x20 in hex). You'll commonly see %20 in file download URLs, search query URLs, and API endpoints. In HTML form submissions (using application/x-www-form-urlencoded), spaces may also appear as + instead of %20 โ€” both are valid in query strings, but %20 is correct in all URL contexts. Use the decoder above to convert any %20 sequences back to readable text.
Both %20 and + can represent a space, but in different contexts. %20 (RFC 3986 percent-encoding) is the universally correct way to encode a space in any part of a URL โ€” path, query string, or fragment. + represents a space only in the application/x-www-form-urlencoded format used by HTML form submissions โ€” specifically in query strings. In a URL path, + is a literal plus sign, not a space. Example: search?q=hello+world (form-encoded) vs search?q=hello%20world (RFC 3986). Both produce the same result in the query string for most web frameworks, but in path segments, only %20 is correct for spaces. The "Encode" function in this tool uses RFC 3986 encoding (with %20 for spaces).
These are the percent-encoded forms of reserved URL characters: %3A = : (colon), %2F = / (slash), %3F = ? (question mark), %26 = & (ampersand), %3D = = (equals sign). These characters have structural meaning in URLs โ€” ? starts a query string, & separates query parameters, = separates keys from values, / separates path segments, : separates the protocol from the host. When these characters appear as data inside a URL parameter value, they must be encoded to prevent the browser from misinterpreting them. For example, if a URL parameter contains another URL as its value, all the : and / characters in the nested URL must be encoded. Use the Decode function above to see what any percent-encoded URL actually says.
Each language has built-in functions for URL encoding. JavaScript: encodeURIComponent('hello world') โ†’ hello%20world (for parameter values); encodeURI('https://example.com/hรฉllo') (for full URLs). Python: from urllib.parse import quote; quote('hello world') โ†’ hello%20world; for query strings: urllib.parse.urlencode({'q': 'hello world'}) โ†’ q=hello+world. PHP: urlencode('hello world') โ†’ hello+world (form-style); rawurlencode('hello world') โ†’ hello%20world (RFC 3986). Java: URLEncoder.encode("hello world", "UTF-8"). C#: Uri.EscapeDataString("hello world"). Always use UTF-8 as the character encoding to ensure correct handling of international characters. Use the tool above to verify what any encoding function produces for a given input. See also our IP Subnet Calculator for other web tools.
A query string is the part of a URL that follows the ? character and contains key-value pairs separated by &. For example: https://example.com/search?q=hello+world&lang=en&page=2 โ€” here the query string is q=hello+world&lang=en&page=2 with three parameters: q=hello world, lang=en, page=2. In the Query String Parser above, paste any URL and click Parse to see all parameters decoded and displayed in a table. In JavaScript, you can parse query strings with new URLSearchParams(window.location.search). In Python: urllib.parse.parse_qs(query_string). Common uses for query strings include search queries, tracking parameters (UTM codes), pagination, filters, and API request parameters.
According to RFC 3986, the following characters are unreserved and safe to use in any URL component without encoding: letters A-Z a-z, digits 0-9, and the symbols: - _ . ~. Everything else should be percent-encoded when used as data. The reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) have structural meaning and should only be used unencoded in their structural role (e.g. ? to start a query, / to separate paths) โ€” when they appear as data in parameter values, they must be encoded. Note that the % character itself must be encoded as %25 if it appears in data (not as part of an encoding sequence). The character reference table in this page shows the encoding for all commonly needed special characters.