Extensions developer and Mac OS Hints contributor canisbos explains how to reveal a forgotten password in a password field on a web page in Safari or Chrome by changing its rendering from asterisks or bullets to standard text characters using the browser’s web inspector.
You can read the tutorial at hints.macworld.com.
And if the manual method described by canisbos sounds geeky and too much like work, a suggested alternative is to install a browser extension that will reveal passwords, such as his ShowPass for Safari, or similar ones that exist for Firefox and Chrome.
With ShowPass, when you move the mouse over a password input field, the password is magically revealed. When you move the mouse out of the password field, the password is obscured again.
ShowPass only works on sites that use the standard HTML tag for password input fields, and makes no attempt to do anything with fancy-pants password fields that use some other method to obscure the password.
You can download ShowPass for free from canisbos.com, where you can also check out canisbos’s out Safari extensions. Note that all of these extensions (and all “native” Safari extensions in general) require Safari 5 or later.