This has come up several times. So, here's quick tutorial.
HTpassword generator. This is an all in one generator of htpassword which is a file you put in a web server to protect a particular directory.
Creating .htpassword. This is how you create a file.
Htpassword Line Generator. This is how you create a hash for the file itself, so there are no clear text passwords in .htpassword