How early for gender ultrasound?

I have a scan booked for Thursday when I will be 16 weeks.

How accurate will they be with telling gender? Im nervous they get it wrong. We are gonna ask them to put it in an envelope for us to open on Christmas day. Imagine it was wrong?

How early can they be confident about gender??