encodeURIComponent()
AD · 728×90
Google AdSense / Яндекс.Директ
URL
encodeURIComponent()
Encodes a URI component by replacing special characters with percent sequences
→ stringPHP: urlencode()ES3+
uriComponentstring
String to encode
encodeURIComponent(uriComponent)
RESULT
— click Run or press Ctrl+Enter —
Parameter Reference
ParameterTypeStatusDescription
uriComponentstringrequiredString to encode
About

encodeURIComponent() escapes all characters except letters, digits, and -_.!~*'() using percent-encoding (%XX). Essential when building URLs with query parameters containing Cyrillic, spaces, or special characters. Unlike encodeURI(), it also encodes /, ?, #, and & — suitable for encoding parameter values, not full URLs.

Browser Support

Introduced in ES3 (1999) as a replacement for the deprecated escape(). Supported by all browsers without exception.

Tips & Gotchas