URL 編解碼工具 - 免費線上編碼/解碼 URL

對 URL 中的特殊字元進行編碼,或將百分號編碼的字串解碼為可讀文字。使用標準 encodeURIComponent/decodeURIComponent 函式。免費、即時,所有處理在瀏覽器本地完成。

Operation Mode
tools.urlEncoder.inputText
tools.urlEncoder.enterTextToEncode
tools.urlEncoder.encodedOutput
tools.urlEncoder.encodedOutput
編碼和解碼 URL 字串

URL Encoding converts special characters into a format that can be transmitted over the internet.

For example, spaces become %20, and other special characters like &, =, and ? are also encoded.

This tool uses encodeURIComponent() anddecodeURIComponent() functions, which encode all characters except:

  • Alphabetic characters (A-Z, a-z)
  • Digits (0-9)
  • Special characters: - _ . ! ~ * ' ( )

使用方法

  1. 選擇編碼或解碼模式。
  2. 在輸入框中貼上或輸入 URL 或編碼字串。
  3. 結果即時顯示,一鍵複製。
  4. 編碼用於含特殊字元的 URL,解碼用於讀取已編碼的 URL。

功能特點

  • 即時 URL 編碼和解碼
  • 使用標準 encodeURIComponent/decodeURIComponent
  • 處理所有特殊字元,包括 Unicode
  • 完全在瀏覽器中運行,資料不會傳送到伺服器
  • 一鍵複製到剪貼簿
  • 免費使用,無需註冊

常見問題

什麼是 URL 編碼?

URL 編碼(也稱百分號編碼)將特殊字元轉換為 URL 安全的格式。空格、&、= 和 ? 等字元會被替換為 % 加十六進位代碼(如空格變為 %20)。

什麼時候需要 URL 編碼?

在查詢參數、表單資料或 URL 中任何可能包含保留字元的部分傳遞特殊字元時需要編碼。這可以防止 URL 被破壞或被錯誤解析。

encodeURI 和 encodeURIComponent 有什麼區別?

encodeURI 編碼完整 URI 但保留 :、/、? 和 # 等字元。encodeURIComponent 編碼除字母、數字和 - _ . ! ~ * '( ) 之外的所有字元,適合編碼單個查詢參數值。

URL 編碼和 HTML 編碼一樣嗎?

不一樣。URL 編碼使用 %XX 格式用於 URL。HTML 編碼使用 &實體;(如 & 表示 &)用於 HTML 內容。兩者用途不同,不應混淆。

使用技巧與相關工作流