Determining the sex of the foetus is done by the decree of Allaah, may He be glorified and exalted. The angel is commanded to write it as Allaah willed in His decree from eternity. Allaah says (interpretation of the meaning):
“To Allaah belongs the kingdom of the heavens and the earth. He creates what He wills. He bestows female (offspring) upon whom He wills, and bestows male (offspring) upon whom He wills”
The person who wants Allaah to bless him with righteous offspring must first avail himself of the means, by getting married and having intercourse in permissible ways. There is nothing wrong with the one who wants his offspring to be male or female availing himself of the means which have been proven by means of experience or tradition or modern science.
There is a statement issued by the Islamic Fiqh Council belonging to the Muslim World League which confirms this idea. In it, it states:
It is permissible to choose the sex of the foetus by natural methods, such as nutritional programs, chemical washing and choosing the time of intercourse to coincide with the time of ovulation, because these are permissible means that do not involve anything haraam.
To read the statement in full [in Arabic], please click on this link:
The one who wants to find valid natural ways of choosing the sex of the foetus may refer to doctors and specialists in this field. We are happy to help readers by quoting from the research of Dr. ‘Abd al-Rahman al-Yahya, in which he says: Nutrition has an effect on choosing the sex of the foetus in two ways:
1. It alters the pH balance in the cervix of the uterus and the vagina. Potassium and sodium turn the environment to alkaline and thus increase the chances of conceiving a male. As for magnesium and calcium, they turn the environment to acidic, thus increasing the chances of conceiving a female.
2. Changes in the wall of the ovum which increase the length of the period during which the ovum is receptive to male or female sperm. Research has proven that the woman's diet has an effect on the sex of the foetus, because it has an effect on the receptors to which the sperm attaches itself on the walls of the ovum, and by means of which it penetrates the wall, thus leading to fertilization.
The ionic balance of sodium and potassium, as opposed to calcium and magnesium, has a biological effect on these receptors, which leads to changes in the composition of the wall, which in turn affects the attraction of male or female sperm.
The effect of these ions is simple: a higher ratio of sodium and potassium in the food and a lower ratio of calcium and magnesium causes changes in the wall of the ovum to attract male sperm and repel female sperm. Hence the result of fertilization will be male. The opposite is also true: a higher ratio of calcium and magnesium in the blood, and a lower level of sodium and potassium, attracts sperm which carries the female chromosome and repels sperm which carries the male chromosome, hence the result of fertilization and pregnancy will be female.
To follow this method, a woman has to follow a specific diet for a period of no less than two months, so as to build up nutritional stores which will encourage the desired gender. We attach a diet plan which shows the sources of calcium, magnesium, potassium and sodium in food.
The women who wants to choose the gender of the baby before conception has to follow this diet for at least 2 to 3 months before pregnancy (without using any hormonal contraceptives; rather barrier methods such as condoms should be used). It is good if the husband follows the same diet plan; although it is not essential for him, at least that will be a psychological support to the wife and help her to stick to the diet plan. The women should continue with this diet until she is certain that she is pregnant. Once she becomes pregnant, she has to stop the diet immediately and consume all the foods that are essential for her body and the body of her baby, as prescribed by her doctor. End quote.
Al-Mukhtasar al-Mufeed fi Tahdeed Jins al-Waleed by Dr. ‘Abd al-Rahmaan al-Yahya, p. 35-36
For information on the diet program suggested by the doctor, please refer to his research which is published on the following site [in Arabic]:
For more information please also see the answer to question number 111849.
And Allaah knows best.