Well that's a rather vague question. If you did a quick search you would have found a plethora of articles and tutorials on encrypting (and decrypting) data.
Common practice with passwords though is to store some hash of the password that you would check against when verifying users, that way you can greatly reduce the chance of an attacker being able to discover all of your passwords. Although this would be useless of your looking for a way to safely store your passwords so that you can view them later.
Maybe you should take a look around here http://www.codeproject.com/KB/security/
Or perhaps do a search
Then if you get stuck on a particular algorithm and need more information post another question with a teeny bit more information and let us know what your trying to achieve. We can't help people who can't help themselves.