Permissibility of Sonography

Answered according to Hanafi Fiqh by

Q: Is it permissible to know the gender of a baby before birth via sonography?

A: It will be permissible but what is the purpose of it? Many a time the scan seems to show a gender but at birth it is the opposite.

It is permissible because the baby has already been formed, but it is a futile exercise.

Moulana Yusuf Laher