You have to wait until they are mature and in breeding condition to tell. The males get little white tubercules on their gill covers and pectoral fins. If you want to know earlier, it is very difficult. Sometimes you can tell by their vent. Males have a longer vent, and females have a rounder and protuding vent.