20 weeks, but the doctors usually aren't 100% sure. The only way to know for sure is if baby is laying in a position that they can clearing identify the gender or an amnio which may have complications.