🍋
Menu
Web

URL Encoding

Percent-Encoding

A mechanism for encoding special characters in URLs using percent signs and hex values.

Technical Detail

URL Encoding is part of the web platform's core infrastructure. Modern browsers implement mechanism through standardized Web APIs, ensuring consistent behavior across Chrome, Firefox, Safari, and Edge. The relevant specifications are maintained by the W3C, WHATWG, or IETF. Understanding the underlying protocol or mechanism helps developers use url encoding correctly, avoid common pitfalls, and optimize for performance and security.

Example

```javascript
// URL encode/decode
encodeURIComponent('hello world & more');
// → 'hello%20world%20%26%20more'

decodeURIComponent('hello%20world');
// → 'hello world'

// Build query string
const params = new URLSearchParams({ q: 'pdf merge', page: '1' });
params.toString();  // 'q=pdf+merge&page=1'
```

Related Tools

Related Terms