🔤 URL Encode / Decode

Encode and decode URLs online

📐 工作原理與說明
URL 編碼把非安全字元轉為百分號加兩位十六進位制(空格轉 %20、中文按 UTF-8 逐位元組轉碼);encodeURIComponent 編碼除 A 至 Z、a 至 z、0 至 9 及減號、下劃線、點、感嘆號、波浪號、星號、單引號、圓括號之外的全部字元;encodeURI 保留冒號、斜槓、問號、井號、方括號、@ 等結構字元以維持完整 URL 語義;解碼為逆過程,非法百分號序列應原樣保留。

Formula & Standard References

Item Formula / Rule Source / Standard
Encoding pipeline Non-ASCII characters are first split into UTF-8 bytes, then each byte becomes %XX RFC 3986 §2.1 / RFC 3629
Decoding A run of %XX octets is reassembled into bytes and then decoded as UTF-8 text WHATWG URL Standard, percent-decode
Reserved characters gen-delims and sub-delims carry meaning in context and must not be encoded blindly RFC 3986 §2.2 Reserved Characters
📌 說明