When entering a password on a login page or web form, it is usually masked with asterisks(*) to prevent people around you from seeing what you typed. However, there are times when you may want to view the hidden password to ensure you’ve entered it correctly. Or you may want to view a password that has been auto-filled by the browser using saved login information.
Although you can view the saved passwords through the browser’s password manager, the process can be time-consuming. However, by using JavaScript, you can easily view the password directly on the login form – especially useful if you’ve forgotten it and you may want to memorize the credential for that specific website.
While there are several freeware tools available for this purpose, most of them can pose security risks. Instead, you can just use a simple and safe JavaScript code snippet that requires no installation and works directly in your browser.
View Hidden Passwords Behind Asterisks
The following JavaScript code helps you display hidden password characters (masked as asterisks) directly on the screen. It works majorly with all browsers such as Firefox, Google Chrome, Opera, Safari, and Edge.
- Copy the code below.
javascript: var p=r(); function r(){var g=0;var x=false;var x=z(document.forms);g=g+1;var w=window.frames;for(var k=0;k<w.length;k++) {var x = ((x) || (z(w[k].document.forms)));g=g+1;}if (!x) alert('There are no passwords found in forms on this page.');}function z(f){var b=false;for(var i=0;i<f.length;i++) {var e=f[i].elements;for(var j=0;j<e.length;j++) {if (h(e[j])) {b=true}}}return b;}function h(ej){var s='';if (ej.type=='password'){s=ej.value;if (s!=''){alert('Password found on this page:\n\n' +s)}else{alert('Password is blank')}return true;}}
- Paste it into your browser address bar.
- Add javascript: at the beginning, if it gets removed automatically.
- Press Enter.
Note: Modern browsers may restrict JavaScript execution directly from the address bar for security reasons. In such cases, use the bookmark method below.
Add a Bookmarket for Quick Access
To make it even easier, you can save the above script as a bookmark.
Option 1: Drag and Drop
Show Password – Drag the link to your bookmarks toolbar
Option 2: Manually Create a Bookmark
- Right-click your bookmarks bar and select “Add Page” or “Add Bookmark”.
- Name it something like “Show Password”.
- Paste the entire JavaScript code as the URL.
- Save it.

Important Note: Use this only on pages where you’re authorized to access passwords. Never use this trick on someone else’s account or system without their knowledge.
this trick is awesome. I added to my chrome and works great.
Id didnt work when i try in IE 6.0
no effect when i put in address bar…
It will not work with old browser
awesome trick.
but, doesn't work in internet explorer. (ie8, ie9)
@ mehul, I never tested on IE 8 and 9. However this code is not working for IE 8 and 9. I will get a fix for IE soon if possible.
Very nice, i suggest webmaster can set up a forum, so that we can talk and communicate.
code not working in firefox…
@c28a340dcf91e0a2fe146c101e1c86fe:disqus
In Firefox 11 and later versions, the code is not
working, due to some security measures. Firefox will not respond to this
JavaScript code. Alternatively, you can use Firefox console, Press Ctrl + Alt + K and paste the code and press Enter.
Not related to your blog post but which tool do you used to make your screencast ?