Encode or decode URL query parameters, paths, and components using percent-encoding. encodeURIComponent is the right tool for most values you put in a URL – this lets you check your work before you ship a link or a redirect.

Related guides