Free URL Encoder & Decoder Online (RFC 3986 Percent-Encoding)

Web Engineering & Security Tool

RFC 3986 URL Encoder & Decoder

Encode query string parameters, path segments, and form values into standardized percent-encoded strings or decode encoded URLs. 100% Client-Side Execution.

Input String / URL 0 chars | 0 bytes
Processed Output 0 chars | 0 bytes
Copied to clipboard!

The Architecture of Percent-Encoding: RFC 3986 URI Standards

A Uniform Resource Identifier (URI) is constrained by a strict grammatical alphabet defined in the Internet Engineering Task Force (IETF) standard RFC 3986. Because URIs must traverse diverse network hardware, proxies, firewalls, and mail relays without mutation, the specification splits characters into two fundamental syntactic sets: Reserved Characters and Unreserved Characters.

When an application must transmit non-ASCII characters (such as Unicode glyphs, spaces, quotes, or binary payloads) within a URI component, those characters must be translated into Percent-Encoding (also colloquially referred to as URL encoding). The character is converted to its underlying UTF-8 byte sequence, and each byte is emitted as a triplet consisting of a percent character % followed by two hexadecimal digits representing the byte’s numeric value (e.g., Space \(\rightarrow\) %20).

URI Character Category Character Set Definition Syntactic Delimiter Role Must Be Percent-Encoded?
Unreserved Characters A-Z, a-z, 0-9, -, _, ., ~ Standard payload data characters NEVER (Encoding them is discouraged)
General Delimiters (gen-delims) :, /, ?, #, [, ], @ Structural delimiters (scheme, authority, path, query, fragment) YES, when appearing inside data components
Sub-delimiters (sub-delims) !, $, &, ', (, ), *, +, ,, ;, = Parameter and query attribute delimiters YES, when part of parameter values
Non-ASCII Characters Accented characters, Asian scripts, Emojis (e.g., 🚀) Multi-byte UTF-8 representations ALWAYS (e.g., 🚀 becomes %F0%9F%9A%80)

encodeURI vs encodeURIComponent vs escape: JavaScript Pitfalls

In client-side JavaScript and Node.js backend services, developers frequently encounter subtle routing and query-parsing bugs due to misunderstandings surrounding browser encoding APIs:

JavaScript Function Characters Left Unencoded Primary Application Context Security Status
encodeURI() ~ ! @ # $ & * ( ) = : / , ; ? + ' Complete URL strings where protocol and path delimiters must survive Safe for full URLs; Dangerous for query parameters
encodeURIComponent() ~ ! * ( ) ' + Alphanumeric (- _ .) Individual query parameters, form values, path segments GOLD STANDARD for all query string values
escape() @ * _ + - . / Legacy ASCII encoding (pre-UTF8) DEPRECATED (Do NOT use); fails on multibyte Unicode

The Space Dilemma: %20 vs + (RFC 3986 vs application/x-www-form-urlencoded)

A classic confusion in API engineering is why spaces are sometimes encoded as %20 and other times as +:

  • RFC 3986 (Pure URI Standard): The space character (ASCII 32, hex 0x20) must strictly be encoded as %20 in URL paths and modern REST endpoints.
  • W3C HTML 4.01 / application/x-www-form-urlencoded: In legacy HTML form submissions via HTTP POST or GET, the form encoding specification mandated that spaces be replaced with a plus sign (+).
  • Production Best Practice: Modern APIs (OpenAPI, GraphQL, Stripe, AWS) expect %20. Decoding engines typically treat both + and %20 as valid spaces, but encoding paths with + can cause 404 errors on NGINX and Amazon S3.

Production Vulnerabilities: Double URL Encoding & WAF Bypasses

One of the most dangerous web application vulnerabilities arises from Double URL Encoding. If an upstream reverse proxy (like Cloudflare, AWS CloudFront, or NGINX) decodes an incoming URL once, and the backend application framework (such as Spring Boot, Express, or Django) automatically decodes it a second time:

Path Traversal via Double URL Encoding Bypass

Payload:            %252e%252e%252f (Intended as ../)
1. WAF Inspection:  WAF sees %252e -> decodes to literal "%2e%2e%2f" (Safe string, not "../")
2. WAF Pass:        Request is allowed through to origin server
3. Backend Server:  Express/Tomcat decodes %2e%2e%2f to "../" (Directory Traversal!)
4. Consequence:     Attacker reads /etc/passwd or proprietary source files.

Edge CDN Cache Optimization: URL Normalization & Query Parameter Ordering

In high-traffic web applications, inefficient URL parameter formatting is a major driver of cache fragmentation, degraded cache hit ratios (CHR), and massive origin egress bills across edge CDNs (such as Cloudflare, Fastly, and AWS CloudFront):

URL Structure Pattern CDN Cache Key Behavior Origin Server Impact Architectural Solution
Unsorted Query Parameters
?a=1&b=2 vs ?b=2&a=1
Creates two distinct cache entries (Cache Miss) Origin processes identical requests twice Enable Query String Sorting at CDN edge
Inconsistent Percent-Encoding
/tags/cloud%20aws vs /tags/cloud+aws
Creates separate cache keys for identical resources Redundant memory allocation in edge RAM Normalize percent-encoding at the ingress reverse proxy
Case-Sensitive Hex Digits
%2f (lowercase) vs %2F (uppercase)
RFC 3986 recommends uppercase; some proxies treat as distinct Cache fragmentation across CDN points of presence Enforce uppercase hexadecimal triplets in client encoders
Trailing Question Marks
/products vs /products?
Treated as two distinct cache keys Unnecessary cache miss on clean URLs Strip empty query string delimiters at edge rewrite rules

UTF-8 Multibyte Byte-Level Encoding Deep Dive

Percent-encoding does not operate on character glyphs; it operates strictly on underlying UTF-8 raw byte sequences. Understanding this mechanism is vital for troubleshooting data corruption across internationalized endpoints:

Unicode Glyph Unicode Code Point UTF-8 Byte Sequence (Hexadecimal) Final Percent-Encoded URI String Total URI Bytes
Dollar Sign ($) U+0024 0x24 %24 (when in reserved context) 3 bytes
Euro Symbol (€) U+20AC 0xE2 0x82 0xAC %E2%82%AC 9 bytes
Japanese Kanji (愛) U+611B 0xE6 0x84 0x9B %E6%84%9B 9 bytes
Rocket Emoji (🚀) U+1F680 0xF0 0x9F 0x9A 0x80 %F0%9F%9A%80 12 bytes

Production Disaster Runbook: Mitigating NGINX Off-By-Slash Path Traversal

A notorious security flaw in NGINX reverse proxy configurations occurs when proxying requests without a trailing slash. When coupled with URL-encoded traversal payloads, an attacker can escape the restricted proxy directory:

Vulnerable vs Hardened NGINX Proxy Pass

# VULNERABLE CONFIGURATION (Off-By-Slash Vulnerability):
location /static {
    alias /var/www/app/static/;
}
# Exploit: GET /static.. -> matches location /static -> resolves to /var/www/app/static/../
# Allows attacker to download application source code and private credentials!

# PRODUCTION-HARDENED CONFIGURATION:
location /static/ {
    alias /var/www/app/static/;
}
# Strict trailing slash prevents directory traversal past the designated alias root.

SSRF Defense: Alternative IP Address Encodings & Hostname Normalization

When web applications accept user-provided URLs to generate preview cards, fetch webhooks, or import remote feeds, attackers frequently utilize esoteric IP address encoding formats to bypass naive regex allowlists and penetrate cloud internal metadata services:

IP Representation Format Raw Input URL Resolved IPv4 Endpoint Security Vulnerability Exploit
Dotted Decimal (Standard) http://127.0.0.1 127.0.0.1 (Loopback) Typically blocked by basic blacklist filters
Dword / Integer Encoding http://2130706433 127.0.0.1 Bypasses filters searching for dots (.)
Hexadecimal Encoding http://0x7f000001 127.0.0.1 Bypasses string-matching WAF rules
Octal Encoding http://0177.0.0.1 127.0.0.1 Interpreted as loopback by underlying C inet_aton
Cloud Metadata (AWS / GCP) http://0xA9FEA9FE 169.254.169.254 Steals IAM instance role credentials and cloud API keys

Internationalized Domain Names (IDN) & Punycode Architecture

A frequent misconception is that URL percent-encoding applies to domain names. In RFC 3986, percent-encoding is strictly prohibited in the hostname / authority segment. To support internationalized Unicode domain names (e.g., bücher.example), browsers utilize Punycode (RFC 3492), translating non-ASCII characters into an ASCII-Compatible Encoding (ACE) prefixed with xn-- (e.g., xn--bcher-kva.example). This prevents IDN Homograph Attacks where Cyrillic lookalike letters spoof legitimate banking and SaaS domains.

HTTP/2 HPACK & HTTP/3 QPACK Compression Interaction

In modern high-concurrency web protocols, URL path strings and query parameters are transmitted via binary multiplexed frames governed by HPACK (RFC 7541 for HTTP/2) and QPACK (RFC 9204 for HTTP/3 over QUIC). These protocols utilize pre-computed static Huffman coding tables to compress HTTP headers:

  • Huffman Compression Efficiency: Common lowercase alphanumeric ASCII characters occupy only 5 to 6 bits in the HPACK static Huffman table, whereas percent-encoded triplets (such as %20 or %F0%9F%9A%80) require three to four times more wire bits. Unnecessarily percent-encoding unreserved characters (-, _, ., ~) impairs edge compression ratios and increases mobile packet transmission latency.
  • Matrix URIs & Semicolon Delimiters: RFC 3986 formally permits the semicolon (;) as a sub-delimiter within path segments to convey matrix parameters (e.g., /residence;country=germany/city;name=berlin). Developers must distinguish between matrix path delimiters and query string delimiters (? and &) when implementing custom reverse proxy rewrite logic.

Terminal Mastery: URL Encoding via Linux CLI, Python & Node.js

When automating bash deployment scripts or curl webhooks, command-line utilities provide instant percent-encoding transformation:

  • cURL URL-Encoding Flag: Use curl --data-urlencode "message=hello world & test" https://api.example.com to automatically percent-encode POST parameters.
  • Python CLI One-Liner: python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "https://zelobiz.com/search?q=cloud"
  • Node.js CLI One-Liner: node -e "console.log(encodeURIComponent(process.argv[1]))" "admin key=secret"
MH

Engineered by Mamun Hossain

Enterprise Systems Architect & Web Security Consultant. Specializing in Web Application Firewall (WAF) rule authoring, reverse proxy URI normalization, input validation defense-in-depth, and REST API contract design.

Frequently Asked Questions About URL Encoding (PAA)

Why does my URL query string break when it contains an ampersand (&)?
In HTTP query strings, the ampersand (&) is the reserved delimiter separating key-value pairs (e.g., ?name=John&age=30). If a parameter value itself contains an ampersand (such as AT&T), you must percent-encode it as AT%26T; otherwise, the web server splits it into two distinct parameters (name=AT and T=).
How are emojis and non-English characters encoded in URLs?
Modern URL encoding adheres to UTF-8. An emoji like 🚀 consists of 4 bytes in UTF-8: 0xF0 0x9F 0x9A 0x80. Percent-encoding converts each individual byte into a hex triplet, producing %F0%9F%9A%80.
What is the difference between URL encoding and Base64?
URL encoding replaces specific reserved or non-ASCII characters with %XX hex triplets while leaving alphanumeric characters readable. Base64 encodes an entire binary or string stream into a fixed 64-character ASCII alphabet, altering every character and increasing overall payload size by 33%.
Is my data secure when using this online URL encoder?
Yes. This tool operates 100% client-side inside your browser sandbox. No strings, confidential API tokens, passwords, or URLs are ever transmitted across the network to any server.