开发者工具 工具
URL Encoder / Decoder
Encode or decode URL components and full URLs (percent-encoding) for safe links, query strings, and APIs.
Free online URL encoder and decoder. Convert text to and from percent-encoding for query strings, API parameters, and shareable links.
为什么人们使用此工具
URL Encoder / Decoder converts text to and from percent-encoding so that special characters such as spaces, ampersands, and non-ASCII letters travel safely inside query strings, API requests, and shareable links.
- Build query strings for tracking links, UTM parameters, and API requests.
- Decode messy redirect URLs to inspect the original destination.
- Sanitize text before pasting it into a URL parameter.
如何使用
- 1Choose Encode or Decode mode.
- 2Pick whether to treat the input as a single component or a full URI.
- 3Paste the text or URL — the result updates instantly.
Best practices
- Use component encoding (encodeURIComponent) for individual query-string values.
- Use full-URI encoding (encodeURI) only when the entire URL needs to be encoded once.
- Decode incoming URL parameters before displaying them to users.
- Always re-encode user input before placing it back into a URL.
Common mistakes to avoid
- Do not double-encode an already-encoded URL — you will end up with %2520 instead of %20.
- Do not encode an entire URL with component encoding; the protocol and slashes will be mangled.
- Do not trust decoded text as safe HTML — escape it before rendering.
- Do not use URL encoding for binary data without Base64.
常见问题
有用的答案What is percent-encoding?
Percent-encoding (URL encoding) replaces unsafe characters with a percent sign followed by two hexadecimal digits, so URLs can travel safely through systems.
What is the difference between encodeURI and encodeURIComponent?
encodeURI preserves URL structure (it does not encode :, /, ?, etc.). encodeURIComponent encodes everything that is not a basic alphanumeric or a few safe symbols, making it correct for individual parameter values.
Is data sent anywhere?
No. Encoding and decoding happen entirely in your browser.