It is not easy when the fish are small but one mature (12" or so) females have fuller body shapes and rounder fins while males have more pointed fins, the pectoral fins are often opaque, and have a raspy texture to their gill plates.
Goldfish have less difference in the finage and many of the fancies are hard to sex but when ready for breeding the males get tubercule on their gill covers.