Should I use encodeURI or encodeURIComponent?
Use encodeURI for a complete URL whose separators should remain intact. Use encodeURIComponent for individual query values or other URL components.
Developer Utility
Encode and decode URL components or complete URLs with JavaScript's standard URI functions. Validate malformed escapes and copy converted text.
Encode or decode text and URLs locally in your browser. Choose whether to preserve URL structure or encode every component character.
Your input is processed only in this browser.
Use URL component mode for individual query values. Use Full URL mode to encode or decode a complete URL while preserving its structural delimiters.
Convert text and URLs with separate Encode and Decode actions. Choose URL component mode to escape reserved characters, or full URL mode to preserve URL separators and structure.
The tool uses JavaScript's built-in encodeURIComponent, encodeURI, decodeURIComponent, and decodeURI functions. All conversion runs locally in your browser.
encodeURI and decodeURI are intended for a complete URI. They preserve characters that have structural meaning in URLs, such as slashes, question marks, ampersands, and equals signs.
encodeURIComponent and decodeURIComponent are intended for individual values, such as a query parameter. They escape those reserved characters so the value cannot accidentally change the surrounding URL structure.
A percent-encoded sequence starts with % followed by exactly two hexadecimal digits. Decoding also validates UTF-8 sequences, so truncated, malformed, or invalidly encoded input produces a clear error instead of an incorrect result.
Encode or decode only once for each corresponding step. Double encoding changes percent signs into encoded text and can require more than one decoding pass to restore the original value.
Use encodeURI for a complete URL whose separators should remain intact. Use encodeURIComponent for individual query values or other URL components.
Full URL mode preserves URL delimiters. Component mode encodes reserved characters, including delimiters.
No. URI encoding and decoding happen in your browser using built-in JavaScript functions.
These tools are commonly used alongside this one.