As early as 10 weeks by the blood tests/genetic testing. That is 99% accurate! I found out by blood work at 12 weeks. Depends on your dr on how early you can find out by ultrasound
I found out at 16 weeks on an ultrasound, but when I was 20 weeks they gave the opposite gender. I had a genetics blood test to confirm, 20 week ultrasound was correct :)