URL 编解码

encodeURIComponent 用于 Query 参数值;encodeURI 用于完整 URL。解码时 + 号会按空格处理。

使用说明

支持 encodeURIComponent / decodeURIComponent(Query 参数)、encodeURI / decodeURI(完整 URL),以及 Query 与 JSON 互转。

左侧输入、右侧实时输出。可使用「切换方向」在编码与解码模式间快速互换。

常见问题

encodeURIComponent 和 encodeURI 有什么区别?
encodeURIComponent 会编码 URL 中的特殊字符(如 ?、&、=),适合单个参数值;encodeURI 保留 URL 结构字符,适合编码完整链接。
Query 中的 + 号如何处理?
在 application/x-www-form-urlencoded 中 + 表示空格。解码参数时会将 + 转为空格。

相关工具