URL Encoder/Decoder

Encode text for URLs or decode URL-encoded strings

URL Encoder/Decoder

Encode text for URLs or decode URL-encoded strings

Preserves: A-Z a-z 0-9 ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) #
Characters: 0 • Spaces: 0
URL Encoding Reference
Common Encodings:
  • Space → %20
  • ! → %21
  • @ → %40
  • # → %23
  • $ → %24
Special Characters:
  • & → %26
  • = → %3D
  • ? → %3F
  • / → %2F
  • + → %2B

URL Encoder / Decoder: Understanding RFC 3986 Percent-Encoding and Web Architecture

In modern web development, network communication, and RESTful API architecture, web addresses (Uniform Resource Identifiers, or URIs) serve as the universal navigational backbone of the internet. The URL Encoder / Decoder is an essential developer utility engineered to translate arbitrary text, special characters, and international Unicode strings into standardized percent-encoded URL formats codified under IETF RFC 3986, and decode them back into human-readable typography.

The original specifications of the World Wide Web mandate that URLs can only contain a strictly defined subset of US-ASCII characters. Any character outside this permitted range—including whitespace, non-Latin international alphabets, mathematical symbols, and emojis—as well as reserved punctuation characters with structural syntactic meaning (such as forward slashes, question marks, and ampersands) must be safely escaped using percent-encoding. Without proper URL encoding, web browsers, API gateways, and web application firewalls (WAFs) misinterpret parameters, truncate URLs, or introduce dangerous security vulnerabilities.

The Mechanics of Percent-Encoding

Percent-encoding operates by replacing any non-permitted or reserved character with a percent symbol (%) followed by a two-digit hexadecimal representation of the character's underlying byte value:

  • Single-Byte ASCII Characters: Standard ASCII characters are represented by a single percent-encoded byte. For example, a blank space has an ASCII decimal value of 32 (hexadecimal 0x20), producing the ubiquitous URL encoding %20.
  • Multi-Byte UTF-8 Characters: Modern international characters and emojis do not fit into a single byte. Under RFC 3986, characters are first encoded into their multi-byte UTF-8 representation (two, three, or four bytes), and each constituent byte is converted into its individual percent-encoded pair. For instance, the Euro symbol (€) maps to UTF-8 bytes 0xE2 0x82 0xAC, resulting in %E2%82%AC.

RFC 3986 Character Classifications: Reserved vs Unreserved

IETF RFC 3986 strictly divides all characters into two fundamental categories:

Character ClassificationPermitted GlyphsEncoding RulesArchitectural Purpose
Unreserved CharactersA-Z, a-z, 0-9, - (hyphen), _ (underscore), . (period), ~ (tilde)Never encoded under standard conditions.Safe for arbitrary use anywhere in URL paths, hostnames, query parameters, or fragments.
Reserved Characters (General Delimiters):, /, ?, #, [, ], @Must be encoded when used as literal data rather than structural delimiters.Used by web engines to delineate protocol schemes, authority domains, paths, queries, and fragment identifiers.
Reserved Characters (Sub-Delimiters)!, $, &, ', (, ), *, +, ,, ;, =Must be encoded when placed inside query parameter keys or values.Used to partition key-value pairs (&, =) and sub-components inside URL queries.

Reference Table: Most Common Percent-Encoded Entities

Below is a reference guide for frequently encountered reserved and special characters in web addresses:

CharacterCharacter NameASCII DecimalStandard Percent-EncodingForm Submission Alternative
[Space]Whitespace Delimiter32%20+ (application/x-www-form-urlencoded)
!Exclamation Mark33%21%21
"Double Quotation Mark34%22%22
#Hash / Anchor Delimiter35%23%23
$Dollar Symbol36%24%24
&Ampersand / Parameter Separator38%26%26
+Plus Symbol43%2B%2B
/Forward Slash / Path Separator47%2F%2F
:Colon / Scheme Delimiter58%3A%3A
;Semicolon59%3B%3B
=Equals Sign / Assignment61%3D%3D
?Question Mark / Query Start63%3F%3F
@At Symbol / User Info Delimiter64%40%40

JavaScript: encodeURI vs encodeURIComponent

In JavaScript web development, confusing encodeURI() with encodeURIComponent() is one of the most widespread causes of broken URLs and API communication bugs:

encodeURI() — Complete URI Encoding

Designed to encode an entire complete URL. It assumes the structural characters that divide components (such as : / ? & = #) are intentional URL delimiters and does not encode them. Use this function only when encoding an entire fully formed URL string.

encodeURIComponent() — Component Encoding

Designed to encode individual query parameter keys, query parameter values, or path segments. It aggressively encodes all reserved characters (including / ? & = + #). Failure to use encodeURIComponent() on query parameter values allows an unescaped & or = to alter query string structure.

Programmatic Implementations in Modern Languages

Software developers can execute URL encoding and decoding reliably across frontend and backend environments:

1. JavaScript (Browser & Node.js ES6+)

// Proper parameter encoding using URLSearchParams
function buildSafeUrl(baseUrl, params) {
  const url = new URL(baseUrl);
  Object.keys(params).forEach(key => {
    url.searchParams.append(key, params[key]);
  });
  return url.toString();
}

// Manual encoding and decoding
const query = "search=HiFi & Tech? + Tools";
const encoded = encodeURIComponent(query);
console.log("Encoded:", encoded);
// Output: "search%3DHiFi%20%26%20Tech%3F%20%2B%20Tools"

const decoded = decodeURIComponent(encoded);
console.log("Decoded:", decoded);

2. Python 3 (urllib.parse)

import urllib.parse

# Standard RFC 3986 percent-encoding (spaces become %20)
raw_text = "HiFi & Toolkit: Ready / 2026?"
encoded_rfc = urllib.parse.quote(raw_text)
print("quote():     ", encoded_rfc)
# Output: "HiFi%20%26%20Toolkit%3A%20Ready%20/%202026%3F"

# Form-style encoding (spaces become +)
encoded_form = urllib.parse.quote_plus(raw_text)
print("quote_plus():", encoded_form)

# Decoding percent-encoded strings
decoded = urllib.parse.unquote(encoded_rfc)
print("unquote():   ", decoded)

Cybersecurity Implications: Double-Encoding and Injection Attacks

Security engineers frequently audit URL encoding behaviors to prevent critical web vulnerabilities:

  • Double-Encoding Vulnerabilities: When an application decodes a URL parameter twice, an attacker can bypass web application firewall (WAF) filters by double-encoding characters. For example, encoding / produces %2F; encoding the percent sign itself produces %252F. If a WAF checks the string before a secondary decoding pass, malicious path traversal (%252E%252E%252F for ../) succeeds undetected.
  • Cross-Site Scripting (XSS): Reflected XSS attacks often inject HTML tags (%3Cscript%3E) through unescaped query parameters. Ensuring strict context-aware URL decoding and HTML entity encoding before rendering input prevents script execution.
  • HTTP Parameter Pollution (HPP): Unencoded ampersands (&) in user inputs allow attackers to inject additional unauthorized query parameters into backend API requests.

URL Normalization and Canonicalization: Best Practices for APIs

When building modern web services and microservices, consistent URL encoding practices are essential for caching, search engine optimization (SEO), and API request idempotency:

  • Uppercase vs Lowercase Percent-Hex Digits: Under RFC 3986 §2.1, percent-encoded hexadecimal digits are case-insensitive, but canonical normalization mandates uppercase hexadecimal digits (e.g., %2F rather than %2f). Utilizing uppercase hex maximizes HTTP reverse proxy cache hit rates across CDNs like Cloudflare and Akamai.
  • Avoiding Over-Encoding: Encoding unreserved characters (such as converting A into %41) is technically permissible under the specification but creates unnecessary string divergence. Canonical URLs should leave unreserved characters in their raw literal form.
  • Query Parameter Sorting: When generating signed API requests (such as AWS Signature Version 4), parameter keys and values must be strictly percent-encoded and sorted in lexicographical ASCII order before calculating cryptographic HMAC signatures.

100% Client-Side Privacy and In-Browser Performance Guarantee

When working with authentication redirect URLs, sensitive OAuth callback parameters, secret API keys, or private web addresses, data privacy is paramount. Our URL Encoder / Decoder operates 100% client-side inside your local browser runtime.

None of your entered URLs, query parameters, or decoded outputs are ever transmitted over the network to external servers or logged in remote analytical databases. The tool operates with zero server latency, instant bidirectional updates, and complete offline capability.

Frequently Asked Questions (FAQs)

URL encoding, also known as percent-encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI). It replaces unsafe ASCII characters with a '%' followed by two hexadecimal digits representing the character's ASCII code.

Use URL encoding when: 1) Including special characters in URLs, 2) Sending form data via GET method, 3) Passing parameters in query strings, 4) Including non-ASCII characters in URLs, 5) Creating URLs programmatically that might contain reserved characters.

encodeURI encodes a complete URI but leaves functional characters like :, /, ?, &, =, etc. intact. encodeURIComponent encodes everything except alphanumerics and - _ . ! ~ * ' ( ). Use encodeURIComponent for URL parameters and encodeURI for complete URLs.

Characters that need encoding include: 1) Control characters (ASCII 0-31, 127), 2) Reserved characters: ; / ? : @ & = + $ , #, 3) Unsafe characters: space, <, >, ", %, {, }, |, \, ^, ~, [, ], `, 4) Non-ASCII characters (Unicode).

URL decoding is the reverse process: it converts percent-encoded characters (% followed by two hex digits) back to their original characters. For example, %20 becomes a space, %40 becomes @, and %E4%BD%A0 becomes the Chinese character '你'.

Spaces can be encoded as either %20 or +. Modern browsers and servers understand both. Our encoder uses %20 for consistency. When decoding, both %20 and + are converted to spaces.

Yes, but be careful. encodeURI is designed for complete URLs and preserves characters needed for URL structure. encodeURIComponent is for URL components/parameters. Our tool offers both options.

Yes, our encoder/decoder fully supports Unicode characters. Non-ASCII characters are encoded as UTF-8 byte sequences, then percent-encoded. For example, 'é' becomes %C3%A9 (UTF-8 bytes C3 A9).

URL-safe Base64 is different from URL encoding. It's a Base64 variant that uses - and _ instead of + and / to make Base64 strings safe for URLs without additional encoding. Our Base64 tools handle this separately.

Always validate and sanitize URLs before decoding to prevent injection attacks. Be cautious when constructing URLs from user input. Use proper validation and consider using allowlists for safe characters.

Explore Related Tools

Hand-picked utilities and calculators related to this tool.

Binary Converter Tools