During an ultrasound, the technician will be able to determine the sex depending on your baby's position and how far along you are in pregnancy. Before 18 weeks, it can be hard to tell girls and boys apart. And if your baby's genitals aren't visible during the ultrasound, you won't be able to learn the sex.