How to Encode and Decode a URL Online: Complete Guide
Seeing strings such as %20, %26, %3D, or %E2%9C%93 inside a
link can look mysterious, but they are normal examples of percent-encoding. It is a standardized way of representing
bytes inside a URI when a character cannot be used directly in that context or would otherwise be interpreted as URL
syntax.
This guide explains how to encode URL components, how to decode an encoded URL, why full URLs and URL parameters
need different treatment, when spaces become %20 or +, and how to avoid double-encoding
problems.
What Is URL Encoding?
URL encoding is also called percent-encoding. RFC 3986 describes percent-encoding as a way to represent an octet
with a percent sign followed by two hexadecimal digits. For example, the ASCII space byte is represented as
%20. The standard also separates reserved characters, which may act as delimiters, from
unreserved characters such as letters, digits, hyphen, period, underscore, and tilde.
citeturn416641search1
Why Do URLs Need This?
A URL is structured data, not just a sentence. Characters such as ?, #,
&, and = can have structural meanings. When those characters are part of the actual
data, they may need percent-encoding so the receiving system does not mistake data for syntax.
citeturn416641search1
URL Component vs Full URL Encoding
| Task | Use | What stays structural? |
|---|---|---|
| Encode a query value or arbitrary text | Component encoding | Nothing from the component is assumed to be URL structure |
| Encode a complete URL | URL/full-URL encoding | Protocol, slashes, query delimiters and fragment structure remain meaningful |
| Decode a percent-encoded value | Component decoding | Encoded characters become data again |
In JavaScript, encodeURIComponent() is designed for an individual URI component, while
encodeURI() leaves characters that belong to URI syntax unescaped. That distinction is why blindly
passing an entire URL to encodeURIComponent() can produce an unusable address. citeturn416641search5
How to Encode and Decode a URL Online
Encode a URL Component
- Open the URL Encoder & Decoder.
- Keep URL Component mode selected.
- Paste text, a search term, a filename, or one query-parameter value.
- Click Encode.
- Copy the percent-encoded result.
Encode a Complete URL
- Select Full URL mode.
- Paste an absolute URL beginning with
http://orhttps://. - Click Encode.
- Review the output and test the final link.
Decode
- Paste an encoded value or encoded URL.
- Choose the matching mode.
- Click Decode.
- Check the readable output before reusing it.
Common URL Encoding Examples
| Input Character | Percent-Encoding | Typical Use |
|---|---|---|
| Space | %20 | Search terms and data values |
| & | %26 | Literal ampersand inside one value |
| = | %3D | Literal equals sign inside one value |
| # | %23 | Literal hash inside data |
| ? | %3F | Literal question mark inside data |
| % | %25 | Literal percent sign |
| + | %2B | Literal plus sign in component data |
%20 vs +: What Happens to Spaces?
%20 is the percent-encoded representation of a space in URI syntax. Some query-string serialization
formats, especially application/x-www-form-urlencoded, represent a space with +. MDN
documents this behavior for URLSearchParams. Therefore, do not automatically treat every +
in a URL as a universally interchangeable form of %20. citeturn416641search0
Common URL Encoding Mistakes
1. Encoding the Entire URL With encodeURIComponent()
This turns structural characters such as :, /, and ? into data. Use
component encoding for component data and URL-aware encoding for the complete address.
2. Double-Encoding
RFC 3986 advises against encoding the same string more than once. A literal percent sign in an encoded sequence can
become %25, producing values such as %2520 instead of %20.
citeturn416641search2
3. Decoding Before Parsing URL Structure
Reserved characters can regain delimiter meaning after decoding. Parse the URL into components first, then decode the data that belongs to those components. citeturn416641search2
4. Assuming URL Encoding Provides Security
Percent-encoding is representation, not encryption. Anyone who has the URL can decode its percent-encoded characters. Never use URL encoding as a substitute for authentication, encryption, or secret storage.
Developer Examples
summer sale & deals →
summer%20sale%20%26%20deals✓ becomes %E2%9C%93 when
its UTF-8 bytes are percent-encoded. RFC 3986 explains the UTF-8-to-octet step for non-ASCII characters.
citeturn416641search2JavaScript
For an individual value, JavaScript provides encodeURIComponent() and
decodeURIComponent(). For a complete URI, encodeURI() and decodeURI()
preserve URI syntax characters differently. citeturn416641search5
Python
Python’s URL utilities provide quote-style functions for percent-encoding components. The important principle remains the same: encode the data at the level where it is inserted into the URL.
Related SmartWebHub Tools
When you need a human-readable SEO path from a title, our Text to Slug tool is more appropriate than percent-encoding a sentence. When an API workflow contains JSON, the JSON Formatter can help you validate and format the payload before constructing requests. For binary-to-text conversion, use the Base64 Encoder & Decoder. These tools solve different problems and should not be treated as interchangeable encoding methods.
Frequently Asked Questions
How do I encode decode URL online for free?
Paste a text value, query value, or complete URL into the tool, choose the appropriate mode, and click Encode or Decode. The tool performs the conversion in your browser.
Why is URL component encoding different from full URL encoding?
A component is data inside a URL, while a full URL contains structural delimiters such as : / ? & and #. Component encoding can encode those characters as data; full URL encoding should preserve the URL structure.
What is percent-encoding?
Percent-encoding represents an octet with a percent sign followed by two hexadecimal digits, such as %20 for a space byte in ASCII.
What is the difference between %20 and + for a space?
%20 is the percent-encoded space used in URI syntax. Some form/query serialization formats use + for spaces, so the exact representation depends on the context.
Can URL encoding be reversed?
Percent-decoding can reverse an encoded value when the encoded string was produced correctly and is decoded in the correct context.
For standards-level detail, see RFC 3986 and MDN’s encodeURIComponent() documentation.
Open URL Encoder & Decoder →