How to Encode and Decode URLs
URL encoding is one of those things developers deal with constantly — building API requests, debugging redirect URLs, passing data in query strings, or fixing broken links with special characters. This guide shows you how to encode and decode URLs instantly.
When You Need URL Encoding
- Building API requests with query parameters that contain spaces or special characters
- Debugging a URL that looks like
%E6%97%A5%E6%9C%AC%E8%AA%9E - Passing a URL as a parameter inside another URL (e.g., redirect URLs)
- Fixing broken links that contain ampersands, spaces, or Unicode
- Encoding form data for GET requests
How to Encode a URL
Step 1: Open the tool
Go to the URL Encoder & Decoder and make sure the "Encode" tab is selected.
Step 2: Choose the encoding mode
Select Component to encode a value for use inside a query parameter (encodes everything including /, ?, &). Select Full URL to encode a complete URL while preserving its structure.
Step 3: Enter text and encode
Paste your text or URL, then click "Encode →". The encoded result appears below. Click "Copy" to use it.
How to Decode a URL
Step 1: Switch to Decode mode
Click the "Decode" tab.
Step 2: Paste the encoded string
Paste the percent-encoded string (e.g. hello%20world%26lang%3Dja).
Step 3: Click Decode
The decoded, human-readable text appears below. Use the "↕ Swap" button to quickly re-encode the result.
Tips
- When encoding a URL to pass as a parameter, always use Component mode. Full URL mode would leave
&and=unencoded, breaking the outer URL's query string. - The Swap button lets you quickly bounce between encode and decode — useful for debugging double-encoded URLs.
- Need to encode binary data? Use the Base64 Encoder instead — URL encoding is for text, Base64 is for binary.
FAQ
What is URL encoding?
URL encoding (also called percent-encoding) replaces unsafe characters in URLs with a % followed by two hex digits. For example, a space becomes %20 and & becomes %26. This ensures URLs are valid and unambiguous.
What is the difference between Component and Full URL encoding?
Component encoding (encodeURIComponent) encodes everything except letters, digits, and a few safe characters. It's used for query parameter values. Full URL encoding (encodeURI) preserves URL structure characters like ://?#&= so the URL remains navigable.
When should I use Component vs Full URL?
Use Component when encoding a value that will be placed inside a URL parameter (e.g., a search query). Use Full URL when you have a complete URL with special characters in the path and want to keep the URL structure intact.
Is my data uploaded to a server?
No. All encoding and decoding happens entirely in your browser using JavaScript. Your data never leaves your device.
Try It Now
Ready to encode or decode? Open the URL Encoder & Decoder — it works entirely in your browser with no sign-up required.