URL Encoder / Decoder

Encode and decode URL components and full URLs.

Input
Output

What is a URL Encoder & Decoder?

URL encoding (percent-encoding) converts characters that are not allowed in URLs into a safe format using % followed by two hex digits. For example, a space becomes %20, and & becomes %26. URL decoding reverses this process.

Common Use Cases

Encoding query string parameters in URLs
Safely passing special characters in API calls
Encoding form data for HTTP POST requests
Decoding URL-encoded strings from server logs
Building safe redirect URLs with parameters

Tips & Best Practices

πŸ’‘Use encodeURIComponent for query string values (encodes more characters)
πŸ’‘Use encodeURI for full URLs (preserves /, :, ?, &, =)
πŸ’‘Always encode user input before including in URLs to prevent injection attacks

Frequently Asked Questions

What is URL encoding?β–Ό
URL encoding converts special characters into a format that can be safely transmitted in a URL. Characters like spaces, &, ?, and = are replaced with % followed by their hex ASCII code.
What is the difference between encodeURI and encodeURIComponent?β–Ό
encodeURI encodes a complete URL and preserves characters like /, :, and ?. encodeURIComponent encodes a URL component (like a query value) and encodes those characters too.
Why does a space become %20?β–Ό
The ASCII code for a space is 32, which is 20 in hexadecimal. URL encoding uses hex values prefixed with %.