Abdullah bin Masud reported,

The Messenger of Allah ﷺ, who is the truthful and the trusted, said, "Each one of you has his creation gathered in his mother's womb for forty days, then he becomes a clinging clot for a similar period, then a lump of flesh for a similar period. Then an angel is sent to him and is commanded with four matters. He is told to write down his provision, his lifespan, his deeds, and whether he will be wretched or blessed. Then the soul is breathed into him.By Allah, one of you may perform the deeds of the people of Paradise until there is only an arm's length between him and it, but then what was written overtakes him, so he performs the deeds of the people of the Fire and enters it. And one of you may perform the deeds of the people of the Fire until there is only an arm's length between him and it, but then what was written overtakes him, so he performs the deeds of the people of Paradise and enters it."

Abu Dawud 4708

Sahih

حدثنا حفص بن عمر النمري حدثنا شعبة ح و حدثنا محمد بن كثير أخبرنا سفيان المعنى واحد والإخبار في حديث سفيان عن الأعمش قال حدثنا زيد بن وهب حدثنا

عبد الله بن مسعود قال حدثنا

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

أبو داود 4708صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Sunnah
Chapter
Decree
Numbering
Darussalam 4708
Abu Dawud 4708