JavaScript encodeURIComponent() Online
Encode URI component.
Run details
The output updates as you type. The tool processes input in your browser.
Worked example
Encode one path segment or parameter value when separators such as slash and ampersand belong to the data.
a b/c?d=e
a%20b%2Fc%3Fd%3De
JavaScript example
console.log(encodeURIComponent("a b/c?d=e"));
Expected native output
a%20b%2Fc%3Fd%3De
Using this operation in JavaScript
The interactive result uses JavaScript. JavaScript string indexes count UTF-16 code units. Use code-point iteration when working with supplementary Unicode characters.