This is by far the most common question expectant parents ask me. If you are 18 weeks or more when you have an ultrasound, you may be able to determine the sex of your baby, but don't count on it. It isn't always possible to tell the sex if the baby has its legs crossed or is in a breech presentation.
Even if your doctor makes a prediction as to the sex of your baby, remember that ultrasound is a test, and tests are sometimes wrong. Most doctors recommend you not start buying for one sex or the other based on an ultrasound. If you do buy anything, save the receipts!