In most onsen you are supposed to bathe naked. There are separate baths for men and women, so you will only have to be naked in front of people of the same sex. In the rare case where there are communal baths, people wear bathing suits.
You have to take off your shoes before entering the onsen complex. Usually there will be lockers for shoes at the entrance. After paying an entrance fee you enter the gender separate area where there will be lockers for you clothing.
Most modern onsen complexes have ticket machines where you can purchase the entrance ticket and, if you like, a towel, a hairbrush, etc.
Upon entering the bathing facilities, first scrub and clean your whole body carefully. Rinse all soap throughly before entering the hot baths. Most onsen will provide soap, shampoo and conditioner for free. Of course you can also bring your own if you prefer.
Most people use a small rectangular towel in the onsen. The Japanese call it a ‘face towel‘. It is used to scrub your body down when washing up before entering the onsen. While bathing, this towel is either wrapped around the head, placed on top of the head or put on the edge of the bath. It is considered unsanitary to douse the towel in the bath water. You can also use it to slightly cover up your body when walking around or to remove water droplets from your body before returning to the changing room. Face towels are sold at almost all onsen facilities for a mere 200 or 300 yen.
For more impressions of daily life in Japan visit "The Japans"