Language:
كتاب الحيض
6  
Menstrual Periods
(17)
Chapter: "(A little lump of flesh) some formed and some unformed."
(17)
باب مُخَلَّقَةٍ وَغَيْرِ مُخَلَّقَةٍ
Sahih al-Bukhari 318

Narrated Anas bin Malik:

The Prophet (ﷺ) said, "At every womb Allah appoints an angel who says, 'O Lord! A drop of semen, O Lord! A clot. O Lord! A little lump of flesh." Then if Allah wishes (to complete) its creation, the angel asks, (O Lord!) Will it be a male or female, a wretched or a blessed, and how much will his provision be? And what will his age be?' So all that is written while the child is still in the mother's womb."

حَدَّثَنَا مُسَدَّدٌ، قَالَ حَدَّثَنَا حَمَّادٌ، عَنْ عُبَيْدِ اللَّهِ بْنِ أَبِي بَكْرٍ، عَنْ أَنَسِ بْنِ مَالِكٍ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏ "‏ إِنَّ اللَّهَ ـ عَزَّ وَجَلَّ ـ وَكَّلَ بِالرَّحِمِ مَلَكًا يَقُولُ يَا رَبِّ نُطْفَةٌ، يَا رَبِّ عَلَقَةٌ، يَا رَبِّ مُضْغَةٌ‏.‏ فَإِذَا أَرَادَ أَنْ يَقْضِيَ خَلْقَهُ قَالَ أَذَكَرٌ أَمْ أُنْثَى شَقِيٌّ أَمْ سَعِيدٌ فَمَا الرِّزْقُ وَالأَجَلُ فَيُكْتَبُ فِي بَطْنِ أُمِّهِ ‏"‏‏.‏
Reference : Sahih al-Bukhari 318
In-book reference : Book 6, Hadith 23
USC-MSA web (English) reference : Vol. 1, Book 6, Hadith 315
  (deprecated numbering scheme)