I went for a 4d scan at sixteen weeks with both my pregnancies as that's the earliest they could do it through scan.
I'm 12 weeks pregnant and my doctor found out through the blood work
Mid pregnancy anatomy scan which is done between 16-22 weeks usually. I was 19+6 with my first and 21+3 with my second when I found out their genders
I got the blood test done at ten weeks it was free at my doctors office and if you wanna wait they will tell you at your 20 week ultrasound app
There's a blood test you can do at 9 weeks, but will have to pay out of pocket.
You can pay out of pocket for a 3D/4D ultrasound as early as 14 weeks ( and yes it's very accurate you don't have to wait till 20)
Or the Dr will likely tell you at your 20 week anatomy scan.
You can find out in your second trimester ultrasound, usually! Check out this link from MedHelp.org on what prenatal tests can tell you for more info.
http://www.medhelp.org/pregnancy-health/slideshows/Your-Guide-to-Prenatal-Tests/2163/10
This article is also in Week 8 of the I'm Expecting app.