Sahih Bukhari – Hadith No : 3332

Narrated `Abdullah: Allah’s Apostle, the true and truly inspired said, “(as regards your creation), every one of you is collected in the womb of his mother for the first forty days, and then he becomes a clot for an other forty days, and then a piece of flesh for an other forty days. Then Allah sends an angel to write four words: He writes his deeds, time of his death, means of his livelihood, and whether he will be wretched or blessed (in religion). Then the soul is breathed into his body. So a man may do deeds characteristic of the people of the (Hell) Fire, so much so that there is only the distance of a cubit between him and it, and then what has been written (by the angel) surpasses, and so he starts doing deeds characteristic of the people of Paradise and enters Paradise. Similarly, a person may do deeds characteristic of the people of Paradise, so much so that there is only the distance of a cubit between him and it, and then what has been written (by the angel) surpasses, and he starts doing deeds of the people of the (Hell) Fire and enters the (Hell) Fire.”

Hadith In Arabic Text :

حدثنا عمر بن حفص، حدثنا أبي، حدثنا الأعمش، حدثنا زيد بن وهب، حدثنا عبد الله، حدثنا رسول الله صلى الله عليه وسلم وهو الصادق المصدوق ‏”‏ إن أحدكم يجمع في بطن أمه أربعين يوما، ثم يكون علقة مثل ذلك، ثم يكون مضغة مثل ذلك، ثم يبعث الله إليه ملكا بأربع كلمات، فيكتب عمله وأجله ورزقه وشقي أو سعيد، ثم ينفخ فيه الروح، فإن الرجل ليعمل بعمل أهل النار حتى ما يكون بينه وبينها إلا ذراع، فيسبق عليه الكتاب فيعمل بعمل أهل الجنة، فيدخل الجنة، وإن الرجل ليعمل بعمل أهل الجنة، حتى ما يكون بينه وبينها إلا ذراع فيسبق عليه الكتاب، فيعمل بعمل أهل النار فيدخل النار ‏”‏‏.‏

Chapter : Prophets – كتاب أحاديث الأنبياء