The soundest view is that the ʿaqīqah (the newborn’s sacrifice) is an emphatically recommended sunnah, and slaughtering it is better than giving its price in charity. It is an expression of gratitude to Allah for renewing His favour upon the parents through the child’s birth; it draws one closer to Allah, benefits the poor through charity, and serves as a ransom for the newborn.
The prescribed amount is two sheep—close in age and resemblance—for a boy, and one sheep for a girl. This is based on the hadith of Umm Kuraz al-Kaʿbiyyah, who said, “I heard the Messenger of Allah ﷺ say: ‘For a boy, two equivalent sheep; for a girl, one sheep.’” Ahmad and al-Tirmidhi transmitted it, and al-Tirmidhi judged the version from ʿĀʾishah to be authentic.
The rationale for the difference between male and female lies in the fact that, in many rulings, the female counts as half of the male. Moreover, the blessing bestowed on the parents by a son is generally viewed as more complete, and the joy and delight greater; therefore the gratitude expressed is likewise greater.
The optimal time for slaughtering the ʿaqīqah is the seventh day after the child’s birth, though performing it before or after that day is permissible.
It is preferable to name the child on the same seventh day, for the Sunan collections and others record: “He is sacrificed for on his seventh day and named.” If the child is named on the day of birth, there is no harm; indeed, some scholars consider that superior to waiting until the seventh day.