decodeURIComponent() URL decoding
Last updated: 2026-09-09
decodeURIComponent() URL decoding
decodeURIComponent decodes a string encoded by encodeURIComponent.
| Category | Global Functions |
|---|---|
| ES version | ES1 |
📝 Syntax
decodeURIComponent(encoded);
⚙️ Parameters
| encoded | The encoded string. |
|---|
Returns:The decoded string.
Mutates the original:No (returns a new value)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
search JavaScript
💡 Tip Use URLSearchParams for URL params — it decodes automatically.
⚠️ Warning Decoding invalid encoding throws URIError — wrap in try/catch.
🌐 Browser support
| Browser | |||||
|---|---|---|---|---|---|
| decodeURIComponent() | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported by all modern browsers | |||||
🏷️ Related Items
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
QdecodeURIComponent vs decodeURI?
AdecodeURIComponent decodes everything; decodeURI preserves URL structure.
QWhat if decoding fails?
AThrows URIError — wrap in try/catch.
QCan URLSearchParams replace manual decoding?
AYes — it decodes automatically with convenient get/getAll methods.