← Cryptography guide

K087 / Encoding and decoding

URL percent-encoding

percent encoding URL RFC 3986 · Survey date 2026-12-05

A URL encoding scheme representing arbitrary data in URIs using only permitted US-ASCII characters.

CRYPTOGRAPHY LAB / K087

Cryptography Lab · URL percent-encoding

Run real computations and inspect intermediate states step by step.

Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.

Scope: Standard operation

URI component percent-encoding

See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.

Reference ↗

Open lab →

Definition and overview
A URL encoding scheme representing arbitrary data in URIs using only permitted US-ASCII characters. Source document ↗
Classification and reversibility
Reversible string encoding and decoding. Source document ↗
Key or secret requirements
Not confirmed in the survey
Operating principle and structure
Represents each byte as a percent sign followed by two ASCII hexadecimal digits. Source document ↗
Key size, block size and parameters
Not confirmed in the survey
Security strength and recommendation
Not confirmed in the survey
Known attacks and vulnerabilities
Multiple encoding and interpretation differences can enable validation bypasses and confusion attacks. Source document ↗
Standards and certification
Related to RFC 3986 and application/x-www-form-urlencoded. Source document ↗
Typical uses
Represent spaces and special characters in URLs, queries and form data. Source document ↗
Implementations, libraries and tools
Language libraries such as Python urllib.parse.unquote. Source document ↗
Decryption or decoding
Decode %HH sequences back to hexadecimal byte values. Source document ↗
Advantages
Keeps URL strings textual even with special or nonprinting characters. Source document ↗
Limitations and cautions
RFC 3986 and URL-standard percent handling can differ between implementations. Source document ↗
Distinguishing encryption, encoding and hashing
URI representation encoding, not encryption or hashing. Source document ↗

Practical examples

Examples are illustrative; they are not execution-tested implementations or operational recommendations.

Example

Convert input bytes to %HH for insertion into a URL/URI component. Decode the sequences into bytes and interpret them using UTF-8 or the specified charset. No secret is used.

Procedure

Encode: convert to bytes in the target charset (usually UTF-8), distinguish reserved and unreserved characters, replace required bytes with %HH. Decode: restore bytes and interpret the specified charset. This is keyless reversible conversion, not encryption.

Scenario

Use for special characters in search terms/path parameters and form submissions. Servers should revalidate path/query boundaries after decoding to prevent bypasses.

Pitfalls and alternatives

Beware plus versus space, %20 versus +, double encoding, malformed percent sequences and component-specific reserved characters. Validate normalized decoded values; use encryption, signatures or hashing separately for security.

References