W3Schools.com

JavaScript unescape() Function

Function Reference JavaScript Global Functions

Definition and Usage

The unescape() function decodes an encoded string.

Tip: Use escape() to encode strings.

Syntax

unescape(string)

Parameter Description
string Required. The string to be decoded


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The unescape() function is supported in all major browsers.


Tips and Notes

Note: The unescape() functions should not be used to decode URIs. Use decodeURI() functions instead.


Example

Example

Encode and decode a string:

<script type="text/javascript">

var str="Need tips? Visit W3Schools!";
var str_esc=escape(str);
document.write(str_esc + "<br />")
document.write(unescape(str_esc))

</script>

The output of the code above will be:

Need%20tips%3F%20Visit%20W3Schools%21
Need tips? Visit W3Schools!

Try it yourself »


Function Reference JavaScript Global Functions
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE