Monu Tools

URL 編碼 / 解碼

對 URL 和 URL 元件進行百分比編碼和解碼,UTF-8 安全。

如何使用 URL 編碼

  1. 01

    貼上您的文字或 URL。

  2. 02

    選擇編碼或解碼,以及元件或完整 URL 範圍。

  3. 03

    複製結果。

What percent-encoding does

URLs are only allowed to contain a limited set of characters, so anything outside that set, spaces, accented letters, and reserved symbols like & ? / =, has to be escaped. Percent-encoding replaces each such byte with a percent sign and its two-digit hexadecimal value, so a space becomes %20 and an ampersand becomes %26.

This tool encodes text and URLs to percent-encoded form and decodes them back. It is built on the browser's standard encodeURIComponent and encodeURI functions, so the output matches exactly what your own JavaScript would produce, and it is UTF-8 safe for international text.

Encoding and decoding run entirely in your browser, so nothing you paste is sent to a server, which is reassuring when a URL contains tokens or query parameters you would rather not share.

Component mode vs full URL

The scope toggle matters. Component mode (encodeURIComponent) escapes reserved characters like & = ? / and is what you want for a single query-string value or path segment. Full-URL mode (encodeURI) leaves the structural characters intact so a complete URL stays usable.

Common mistakes to avoid

A common mistake is encoding an entire URL with component mode, which escapes the :// and ? and breaks the link. Another is double-encoding, where an already-encoded string is encoded again and %20 turns into %2520. When in doubt, decode first to see the raw value.

The plus-sign quirk in query strings

There is also a historical quirk in query strings: form submissions encode a space as a plus sign, while percent-encoding uses %20. Both are seen in the wild, so decoders generally accept either.

常見問題

元件與完整 URL 有何區別?

「元件」(encodeURIComponent)會轉義 & = ? / 等保留字元,適用於查詢值。「完整 URL」(encodeURI)會保留 URL 結構。

為什麼解碼失敗?

格式錯誤的百分比序列(如單獨的 %)無法解碼。請檢查輸入,或先重新編碼。

來源

嵌入此工具

將此工具加入你自己的網站。複製下方的程式碼片段,它會自動保持最新。

<iframe src="https://monu.tools/embed/zh-Hant/url-encoder" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

相關工具