Free Online URL Encoder & Decoder
Percent-encode text so it is safe to use in a URL, or decode an encoded URL or query value back into readable text. The conversion runs in your browser.
How to Use URL Encoder & Decoder?
Select Mode
Choose "URL Encode" to percent-encode strings or "URL Decode" to restore plain text.
Configure Options
Toggle Strict component mode (encodeURIComponent) or format spaces as "+".
Copy Result
Click "Copy Result" to copy the result to your clipboard.
How URL Percent-Encoding Works (RFC 3986)
A Uniform Resource Identifier (URI), commonly referred to as a URL or web address, is bounded by strict character set rules formalized in RFC 3986 by the Internet Engineering Task Force (IETF). Because network transport protocols (such as HTTP/1.1 and HTTP/2) were architected around the 7-bit US-ASCII character standard, any non-ASCII character, control code, or reserved delimiter placed inside a URL must be transformed into a standardized percent-encoded format (URL encoding).
Percent-encoding functions by taking the character's UTF-8 byte sequence and translating each byte into a triplet: the percent sign % followed by two uppercase hexadecimal digits representing the byte's numeric value (e.g. a standard space character 0x20 becomes %20).
Anatomy of a Complete URI & Encoding Scope
A standard web URL comprises multiple functional components separated by reserved syntax characters:
Protocol delimiter
Host & Port
Resource path
Key-value parameters
Client anchor
Reserved vs. Unreserved Characters Reference (RFC 3986)
RFC 3986 divides the entire printable ASCII character range into two distinct classifications:
| Classification | Characters Included | Encoding Rule | Architectural Purpose |
|---|---|---|---|
| Unreserved Characters | A-Z, a-z, 0-9, -, _, ., ~ |
Never encoded | Safe across all URL components without semantic ambiguity. |
| Gen-Delims (General Delimiters) | :, /, ?, #, [, ], @ |
Encode in parameters | Demarcate major URI boundaries (scheme, path, query, fragment). |
| Sub-Delims (Sub-Delimiters) | !, $, &, ', (, ), *, +, ,, ;, = |
Encode in parameter values | Separate query string key-value pairs (e.g., & and =). |
encodeURI() vs. encodeURIComponent(): Key JavaScript Differences
In client-side JavaScript, confusing encodeURI() and encodeURIComponent() is one of the most common causes of broken web requests:
- encodeURI(): Intended for complete URL strings. It intentionally ignores protocol and path delimiters like
://,/,?,&, and#. If you pass a user query parameter that contains an ampersand (e.g.Ben & Jerry's),encodeURI()leaves the&untouched, corrupting your query parameters into two separate keys! - encodeURIComponent(): Intended for individual parameter keys and values. It aggressively encodes all reserved delimiters (turning
&into%26,/into%2F, and?into%3F), ensuring that special characters are parsed purely as data values by backend routing engines.
Percent-Encoding (%20) vs. Form URL Encoding (+)
Developers frequently encounter confusion regarding why spaces are sometimes formatted as %20 and other times as +:
- RFC 3986 Standard (%20): Under pure URL and URI path specifications, the space character (ASCII 32) must strictly be percent-encoded as
%20. - application/x-www-form-urlencoded (+): HTML form submissions dating back to early HTML 2.0 specifications defined that spaces within form query bodies should be converted to a plus sign
+. In modern RESTful APIs, using%20is standard and universal.
URL Encoding Code Implementations Across Backend Languages
Implementation snippets across enterprise web frameworks:
JavaScript / TypeScript
// Safe query string parameter encoding
const query = "AI & Machine Learning";
const url = `https://aiogalaxy.com/search?q=${encodeURIComponent(query)}`;
console.log(url); // https://aiogalaxy.com/search?q=AI%20%26%20Machine%20LearningPython 3 (urllib.parse)
import urllib.parse
# Standard RFC 3986 encoding (%20)
encoded = urllib.parse.quote("Hello World & Friends!")
print(encoded) # Hello%20World%20%26%20Friends%21
# Decoding back to plain text
decoded = urllib.parse.unquote(encoded)
print(decoded)PHP 8
// rawurlencode follows RFC 3986 (spaces become %20)
$param = rawurlencode("Product Name & SKU#123");
echo $param; // Product%20Name%20%26%20SKU%23123
// urlencode follows form-data (+ for spaces)
$formParam = urlencode("Product Name & SKU#123");Frequently Asked Questions
What is URL Percent-Encoding and why is it necessary under RFC 3986?
Uniform Resource Identifiers (URIs) can only consist of a strictly defined set of printable US-ASCII characters. Characters outside this set (such as spaces, punctuation, or non-Latin alphabet characters) must be converted into their UTF-8 byte representation, where each byte is prefixed with a '%' sign followed by two hexadecimal digits (e.g. space becomes %20).
What is the fundamental difference between encodeURI and encodeURIComponent?
encodeURI is designed to encode a full, complete URL without breaking its structural delimiters, leaving characters like '://', '?', '&', and '#' intact. By contrast, encodeURIComponent encodes all reserved characters, making it mandatory for individual query parameter keys and values so they do not inadvertently split URL parameters.
Why are spaces sometimes represented as '+' instead of '%20'?
In standard RFC 3986 URI paths, a space must always be encoded as '%20'. However, according to the older application/x-www-form-urlencoded MIME standard used by HTML form submissions (e.g. GET search queries), spaces are traditionally substituted with a plus '+' sign.
What are 'Reserved' vs 'Unreserved' characters in a Uniform Resource Identifier (URI)?
Unreserved characters (letters A-Z, a-z, digits 0-9, hyphen '-', underscore '_', period '.', and tilde '~') never require encoding and have identical meanings whether encoded or not. Reserved characters (such as ':', '/', '?', '#', '[', ']', '@', '!', '$', '&', ''', '(', ')', '*', '+', ',', ';', and '=') have special syntactic meaning as delimiters and must be encoded when used as raw data.
How does percent-encoding handle non-ASCII and multibyte UTF-8 Unicode characters?
Modern RFC 3986 compliance dictates that characters outside the standard ASCII range are first serialized into their constituent UTF-8 bytes (ranging from 1 to 4 bytes per character). Each individual byte is then converted to its two-digit hexadecimal equivalent prefixed by '%'. For example, the Euro symbol '€' has UTF-8 bytes E2 82 AC, which encodes to %E2%82%AC.
Why does failing to encode query parameters cause security vulnerabilities?
If user-supplied query parameters containing reserved characters like '&' or '=' are concatenated directly into a URL without percent-encoding, an attacker can inject malicious parameter overrides (Parameter Pollution) or alter HTTP redirection destinations (Open Redirect attacks).
Can I encode whole JSON payloads or complex data objects in URL query strings?
Yes, by passing a serialized JSON string through encodeURIComponent(). However, web servers and browser address bars enforce maximum URL length restrictions (commonly 2,048 characters in older clients, or 8,192 bytes on Apache/Nginx). For payloads exceeding a few hundred bytes, HTTP POST with a request body is strongly advised.
Does this online URL tool send my URLs or query parameters to external servers?
No. All encoding and decoding operations run 100% locally within your client browser using JavaScript. No URLs, query parameters, or authorization tokens are transmitted across the internet, protecting your development workflows.