The key is in the anal fin.
In males, the fin right under the base of the tail is pointy and looks "squished together". In females, this fin is shaped like a normal fin, like a triangle or a fan.
Other than that, usually females have a big blackish area at the back of their abdomen towards their tail when they are pregnant, except on a dark-colored female.