Having seen photos and movie clips with lightly dressed Thai girls in front of bars or as go-go dancers, you may find it difficult to believe; nonetheless, Thai people are a very chaste in their public behaviour. That goes for a visit to the beach as well.
You do not find topless Thai women at the beach; female tourists should not be topless either. There are a few beaches where topless women are accepted; mostly at secluded beaches where only tourists come, like Freedom Beach in Phuket.
It is forbidden by law to be naked in public places in Thailand and that includes the beaches; so, no bathing in the nude.
Men can be topless at the beach; however, be sure to wear a T-shirt when you go to and from the beach. Do not run around with a bare upper body anywhere else than on the beach, no matter how impressive a six-pack you are sporting. The Thais will not be impressed. Women should wear a blouse and a skirt or similar when they go to and from the beach.
At the beach, men should wear swim shorts rather than speedos.
Perhaps you were smiling when you read that men can be topless at the beach because you take that for granted. Alas, it is not clear-cut. As you can see in the photo below, Thai men often wear a T-shirt at the beach and when going for a swim. Often, even children are fully clothed when going for a swim.