ML
MindLucidकेवल क्लाइंट-साइड
डेवलपर उपयोगिताएँ
शून्य सर्वर अपलोड (100% स्थानीय)
स्थानीय निष्पादन इंजन: Browser Web API

URL Encoder / Decoder & Query Inspector

Inspect full URLs, parse query string parameters into an editable table, test encodeURI and encodeURIComponent, and rebuild clean URLs client-side.

Parsed locally in browser memory. URLs and parameters are never uploaded.
Native WHATWG URL API • 100% Offline

URL Components

Protocolhttps:
Hostnameapi.example.com
Port8443
Pathname/v1/search
Hash Fragment#results

Query Parameters (4)

=
=
=
=
URL Encoder / Decoder & Query Inspector आपकी गोपनीयता की रक्षा कैसे करता है?

पारंपरिक ऑनलाइन टूल्स के विपरीत जो आपकी फ़ाइलों या छवियों को अज्ञात रिमोट सर्वर पर अपलोड करते हैं, MindLucid पूरी तरह से आपके ब्राउज़र के अंदर काम करता है।

  • प्रत्यक्ष इन-मेमोरी प्रोसेसिंग: डेटा केवल नेटिव वेब एपीआई (HTML5 Canvas, Web Crypto, WebAssembly) द्वारा रैम में पढ़ा जाता है।
  • शून्य ट्रैकिंग व टेलीमेट्री: कोई ट्रैकिंग कुकीज़ नहीं, कोई सर्वर लॉग नहीं और आपकी गोपनीय फ़ाइलों की कोई निगरानी नहीं।
  • तुरंत डिवाइस पर डाउनलोड: रूपांतरित होते ही फ़ाइलें स्थानीय रूप से ब्लॉब के रूप में बनती हैं और सीधे आपके डिवाइस में सुरक्षित हो जाती हैं।
क्लाइंट सैंडबॉक्स सुरक्षा मुहर

100% ऑफ़लाइन कार्यक्षमता

आप अभी अपना इंटरनेट कनेक्शन बंद कर सकते हैं। यह टूल बिना किसी रुकावट के काम करता रहेगा क्योंकि इसका निष्पादन इंजन पहले से ही आपके ब्राउज़र में लोड है।

स्थिति: 100% सुरक्षित स्थानीय निष्पादन

URL Encoder / Decoder & Query Inspector का उपयोग कैसे करें (चरण-दर-चरण)

1

इनपुट सुरक्षित रूप से लोड करें

अपने टेक्स्ट या फ़ाइल को सीधे ब्राउज़र के सुरक्षित वर्कस्पेस में पेस्ट या अपलोड करें।

2

विकल्प अनुकूलित करें

लाइव पूर्वावलोकन के साथ सेटिंग्स को अपनी आवश्यकतानुसार समायोजित करें।

3

त्वरित परिणाम प्राप्त करें

बिना किसी सर्वर विलंब के अपने संसाधित परिणाम को कॉपी या डाउनलोड करें।

2,540 Words (Technical Handbook)~13 Min ReadRFC 3986 / WHATWG URL Standard

Uniform Resource Identifier (URI) & Percent-Encoding Engineering Guide

An exhaustive, production-grade architectural guide covering formal specifications, internal algorithmic execution, time and space complexity, multi-language code snippets, cryptographic security hardening, and real-world enterprise design patterns.

01
Specification Standards

URI Syntax Specifications, Percent-Encoding & Character Sets

A Uniform Resource Identifier (URI), standardized under IETF RFC 3986 and modern WHATWG URL Living Standard specifications, provides a globally unambiguous syntax for referencing resources across computer networks and local software runtimes. The underlying grammar of URIs operates within a strictly defined subset of US-ASCII characters. Because arbitrary data transmitted across HTTP requests often contains binary data, Unicode code points, or reserved delimiter characters (such as ?, &, =, /, and #), an unambiguous translation mechanism termed Percent-Encoding (or URL Encoding) is required.

RFC 3986 partitions the US-ASCII character repertoire into three structural classes: Unreserved characters, Reserved characters, and Other (prohibited) characters. Unreserved characters comprise uppercase and lowercase alphanumeric letters (A-Z, a-z), decimal digits (0-9), and four literal symbols: hyphen (-), underscore (_), period (.), and tilde (~). These characters have zero special syntactical meaning and MUST never be encoded.

Reserved characters are designated syntactical delimiters that segment a URI into components: scheme, userinfo, host, port, path, query, and fragment. Reserved characters include general delimiters (gen-delims: :, /, ?, #, [, ], @) and sub-delimiters (sub-delims: !, $, &, ', (, ), *, +, ,, ;, =). When any of these characters are utilized for literal data payload rather than syntax partitioning, they must be converted into their hexadecimal percent-encoded representation (%HH).

In contemporary software development, percent-encoding operates on raw UTF-8 byte streams rather than legacy single-byte ASCII code pages. For example, the Unicode symbol "€" (Euro) encodes in UTF-8 as three bytes: 0xE2 0x82 0xAC, serializing in a URI as %E2%82%AC. In contrast, legacy HTML application/x-www-form-urlencoded forms encode space characters as "+", whereas standard RFC 3986 mandates %20.

Historical Engineering Context

Devised by Tim Berners-Lee in 1994 under RFC 1630 and refined through RFC 2396, percent-encoding was engineered to guarantee that URIs could survive transmission across archaic 7-bit ASCII teletypes and heterogeneous email gateways without truncation or byte corruption.

Standards & RFC Compliance:
IETF RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
WHATWG URL Living Standard (Modern browser implementation standard)
W3C HTML5 Specification: application/x-www-form-urlencoded serialization
IETF RFC 3629: UTF-8, a transformation format of ISO 10646
02
Algorithmic Mechanics

Byte-Level Percent-Encoding Engine, UTF-8 Streaming & Query Parsers

Time Complexity

O(N) Linear Time - Operates in single-pass linear time relative to input character byte count.

Space / Memory Complexity

O(N) Linear Memory - Maximum output expansion is 3x input byte length (when every byte is encoded as %HH).

Percent-encoding execution follows a strict byte-level stream pipeline. The input string is first decomposed into its UTF-8 octet sequence. JavaScript engines achieve this via TextEncoder or low-level UTF-16 surrogate pair conversion.

Encoding Algorithm: The parser iterates across each byte in the UTF-8 sequence. If the byte corresponds to an unreserved ASCII code point (0x30-0x39, 0x41-0x5A, 0x61-0x7A, 0x2D, 0x2E, 0x5F, 0x7E), the raw ASCII character is output directly to the destination buffer. If the byte falls outside this range or represents a reserved delimiter in context, an escape sequence is emitted: a percent symbol (0x25) followed by two uppercase hexadecimal digits representing the byte value ((byte >> 4).toString(16) and (byte & 0x0F).toString(16)).

Decoding Algorithm: The decoder traverses the input stream. When encountering a percent character (% / 0x25), it inspects the subsequent two characters. The parser verifies that both characters are valid hexadecimal digits ([0-9A-Fa-f]). If valid, the two digits are parsed into an 8-bit unsigned integer via (hex1 << 4) | hex2 and appended to an accumulator byte buffer. Once the full sequence of percent-encoded bytes for a multi-byte UTF-8 code point is reconstructed, the byte buffer is decoded into UTF-16 code units.

Security Guard: Malformed byte sequences (e.g., %ZZ, truncated percent signs like %E2%82 at the string terminator, or invalid UTF-8 byte sequences) must throw deterministic parsing errors (URIError in JavaScript) rather than silently outputting corrupt replacement characters (U+FFFD), preventing homograph and bypass vulnerabilities.

Core Data Structures & Memory Layout:
UTF-8 Byte Array (Uint8Array)Bitmask lookup table (128-bit array for O(1) unreserved character testing)Key-Value Map/Dictionary for parsed query parameter AST
03
Comparative Analysis

Encoding Functions & Standards Comparison Matrix

Function / StandardTarget ScopeEncodes Delimiters (?, &, =)Space Character EncodingRFC Compliance
encodeURIComponent()Query values & path segmentsYes (converts to %3F, %26, %3D)Outputs %20Standard for encoding individual query parameter values in modern client-side JavaScript.
encodeURI()Complete URI stringsNo (preserves protocol & delimiters)Outputs %20Intended to encode a full URI while keeping structural routing intact. Dangerous for query parameter values.
application/x-www-form-urlencodedHTML form submissionsYesOutputs "+" instead of %20Legacy web standard. Spaces converted to plus signs; requires careful handling during server deserialization.
URLSearchParams APIQuery string objectsYesOutputs "+"Modern Web API for constructing and iterating query string parameters with automatic decoding.
04
Production Code Blueprints

Multi-Language Implementation Blueprints

Robust TypeScript URL Encoder, Decoder & Query Parser
// Safe RFC 3986 compliant encoding including !'()*
export function rfc3986Encode(str: string): string {
  return encodeURIComponent(str).replace(/[!'()*]/g, (c) => {
    return '%' + c.charCodeAt(0).toString(16).toUpperCase();
  });
}

// Deep URL Query String Parser with nested array support
export function parseQueryString(queryString: string): Record<string, string | string[]> {
  const cleanQuery = queryString.startsWith('?') ? queryString.slice(1) : queryString;
  const result: Record<string, string | string[]> = {};
  if (!cleanQuery.trim()) return result;

  const pairs = cleanQuery.split('&');
  for (const pair of pairs) {
    if (!pair) continue;
    const [rawKey, rawValue = ''] = pair.split('=');
    
    // Replace '+' with space prior to decoding (handling form-urlencoded)
    const key = decodeURIComponent(rawKey.replace(/\+/g, ' '));
    const value = decodeURIComponent(rawValue.replace(/\+/g, ' '));

    if (key in result) {
      if (Array.isArray(result[key])) {
        (result[key] as string[]).push(value);
      } else {
        result[key] = [result[key] as string, value];
      }
    } else {
      result[key] = value;
    }
  }
  return result;
}

Technical Note: Implements full RFC 3986 compliance, handling space normalization, edge-case delimiters, and duplicate query keys.

05
Vulnerability Analysis & Hardening

URL Encoding Security Vulnerabilities & Injection Vectors

CWE-116: Improper Encoding or Escaping of Output & Double Decoding Attacks

Double Decoding Vulnerability: A critical security flaw occurring when an upstream reverse proxy or web application firewall (WAF) decodes a URL once for inspection, and the downstream application server decodes it a second time. An attacker submits %252F or %252E%252E%252F. The WAF decodes %25 to % and sees harmless %2F or %2E%2E%2F, bypassing path traversal filters. The backend server then decodes %2F into a literal "/" or "../", executing directory traversal and reading sensitive system files.

Server-Side Request Forgery (SSRF) Delimiter Injection: When backend services construct outbound HTTP requests by interpolating unsanitized user strings into URLs, missing percent-encoding allows attackers to inject ? or # characters. For example, passing user input containing "#internal.api" can truncate the query string and redirect internal routing.

Open Redirects via Parameter Confusion: Passing unencoded URLs inside redirect parameters (e.g., /login?return_to=https://attacker.com) can deceive authentication gateways into redirecting users to phishing portals.

Mandatory Security Countermeasures & Defensive Best Practices:
Never double-decode URLs: Ensure your routing stack decodes each URL segment exactly once at the entry layer.
Strictly validate redirect URLs: Disallow full absolute URLs in return parameters; enforce relative path whitelisting (/dashboard instead of https://...).
Use native URL parser objects (such as new URL() in JavaScript or urllib.parse in Python) rather than regex string concatenation to build outbound endpoints.
06
High-Scale Distributed Systems

Enterprise Case Study: High-Volume Global Search Engine & CDN Edge Gateway

Problem Statement:

A global e-commerce search engine serving 2 billion daily search requests was suffering cache fragmentation and high origin server load due to inconsistent URL query parameter ordering and duplicate percent-encoding across regional marketing campaigns.

Architectural Solution Architecture:
1
Implemented a canonicalization edge worker at the Cloudflare / CDN edge layer.
2
The worker normalizes inbound query strings by lowercasing hexadecimal escape sequences (e.g., converting %2f to %2F), sorting query keys alphabetically, and stripping tracking parameters (utm_*, fbclid).
3
All parameter values were parsed and re-encoded using RFC 3986 strict unreserved character sets, transforming disparate query strings into identical cache keys.
Measured Impact: Edge CDN cache hit ratio jumped from 58% to 89%; origin database load decreased by 42% during peak sales events.
07
Boundary Conditions

Edge Cases, Pitfalls & Troubleshooting Matrix

Plus sign (+) ambiguity between query string and path

Pitfall: Assuming "+" always means space across all parts of a URL.

Consequence: Path segments interpret "+" as a literal plus sign, while query strings in form submissions interpret it as a space.

Engineering Solution: Always encode literal plus characters in query values as %2B, and use %20 exclusively for literal spaces.

Encoding multi-byte Unicode emoji and astral symbols

Pitfall: Encoding surrogate pairs individually in legacy runtimes.

Consequence: Corrupt 4-byte UTF-8 sequences causing server-side decoding exceptions.

Engineering Solution: Ensure the encoder utilizes modern UTF-8 byte stream transformation (TextEncoder) before percent escaping.

Reserved delimiters in username/password URL segments

Pitfall: Passing colons or @ symbols inside basic auth credentials: http://user:p@[email protected].

Consequence: Host parser misinterprets the @ sign, directing traffic to an unauthorized domain.

Engineering Solution: Percent-encode all credentials (%40 for @) prior to assembling the full authority URI string.

Query string key duplication without array semantics

Pitfall: Sending filter=red&filter=blue to backends expecting a single string scalar.

Consequence: Silent overwriting of parameters where only the last value (blue) is processed.

Engineering Solution: Use standardized array notation (filter[]=red&filter[]=blue) or configure backend parsers to preserve arrays.

08
Engineering Knowledge Base

Deep Technical FAQs & Architectural Queries

What is the fundamental difference between encodeURI() and encodeURIComponent()?
encodeURI() is designed to encode a full, complete URI (e.g., "https://example.com/search?q=test"). It leaves structural URI delimiters intact (such as :, /, ?, #, &, and =) so that the resulting string remains a valid functional URL. encodeURIComponent() is designed to encode an individual data value (like a search term or username) intended to sit inside a query parameter or path segment; it aggressively encodes all reserved delimiters including &, =, ?, and / so they do not break the surrounding URL grammar.
Why are spaces sometimes encoded as %20 and sometimes as +?
The difference stems from historical standards. RFC 3986 (the general URI specification) strictly mandates that spaces must be encoded as %20. However, the HTML specification defines application/x-www-form-urlencoded (used by standard web form submissions), which historically maps spaces to "+" and literal plus signs to %2B. When building modern RESTful APIs and query parameters, %20 is the universally preferred standard.
How are international Unicode characters (like Japanese or Arabic) encoded into URLs?
Under modern standards (RFC 3986 and WHATWG), Unicode characters are first encoded into their corresponding sequence of UTF-8 bytes (ranging from 1 to 4 bytes). Each byte is then independently converted into a three-character percent-encoded triplet (%HH). For example, the Arabic letter "م" is represented by two UTF-8 bytes (0xD9 0x85), which encodes into the URL string as %D9%85.
Can percent-encoded URLs be used to bypass web application firewalls (WAFs)?
Yes, if the security architecture is misconfigured. In double-encoding attacks, malicious payloads (such as <script> or ../) are encoded twice (e.g., %253Cscript%253E). If an upstream WAF only decodes the payload once and fails to recognize the hidden escape sequences, but a downstream application server decodes it again, the malicious script executes. Modern security gateways inspect recursively until no percent signs remain.
What characters should never be percent-encoded according to RFC 3986?
The unreserved character set should never be encoded. This consists of lowercase letters (a-z), uppercase letters (A-Z), decimal digits (0-9), hyphen (-), underscore (_), period (.), and tilde (~). Encoding these characters does not alter their meaning, but causes unnecessary URL bloat and can break legacy software matching routines.
What causes the JavaScript error "URIError: URI malformed"?
This error is thrown by decodeURI() or decodeURIComponent() when they encounter an invalid percent sequence. Common causes include a dangling percent sign at the very end of a string (e.g., "discount=10%"), non-hexadecimal characters following a percent sign (e.g., "%ZZ"), or an incomplete multi-byte UTF-8 sequence where expected continuation bytes are missing.
How do fragment identifiers (#) behave with percent encoding?
The fragment identifier is demarcated by a hash symbol (#) and indicates a client-side sub-resource or anchor. In HTTP requests, web browsers never send the fragment to the server. If you intend to pass a literal hash symbol as data inside a query parameter, it must be percent-encoded as %23. If sent unencoded, the browser truncates the request at the hash, and the server never receives the remaining parameters.
What is the maximum allowed length of a URL across modern web browsers?
While the HTTP specification does not impose an arbitrary limit on URL length, real-world implementations do. Modern browsers (Chrome, Edge, Firefox, Safari) support URLs up to 64,000 characters, but enterprise web servers and cloud CDNs (such as Nginx, Apache, and AWS CloudFront) typically enforce default request line limits of 8,192 bytes (8KB). URLs exceeding 8KB result in HTTP 414 "URI Too Long" errors.