A single unencoded ampersand in a URL can break an API call. Spaces, unicode characters, and reserved symbols all need proper encoding to travel safely through HTTP. URL encoding mistakes cause silent data corruption that's notoriously hard to debug.
What Is URL Encode/Decode?
URL encoding (percent-encoding) replaces unsafe ASCII characters with a % followed by their hexadecimal code. Spaces become %20, ampersands become %26, and unicode characters get multi-byte encoding. Our URL Encoder/Decoder handles full URLs and individual components correctly.
How to Use URL Encode/Decode on DevToolHub
- Open the URL Encode/Decode tool on DevToolHub — no signup required.
- Paste or enter your input data in the left panel.
- See the result instantly in the output panel.
- Copy the result or download it as a file.
Encoding Query Parameters
Special characters in search queries must be encoded:
// Unencoded (BREAKS the URL)
https://api.example.com/search?q=price < $50 & available=true
// Properly encoded
https://api.example.com/search?q=price%20%3C%20%2450%20%26%20available%3Dtrue
// In JavaScript
const query = "price < $50 & available=true";
const url = `https://api.example.com/search?q=${encodeURIComponent(query)}`;Pro Tips
- Use encodeURIComponent() for query parameter values, encodeURI() for full URLs — they encode different characters
- Double-encoding is a common bug — encoding an already-encoded string produces %2520 instead of %20
- Always decode server-side before processing — comparing encoded vs decoded strings causes matching failures
- Test URLs with unicode characters (like city names) to ensure your encoding handles multi-byte correctly
When You Need This
- Building API query strings with user-generated content
- Constructing OAuth callback URLs with state parameters
- Encoding redirect URLs for authentication flows
- Handling file names with spaces in download links
Free Tools Mentioned in This Article