Abdullah ibn Masud reported: The Messenger of Allah, peace and blessings be upon him, and he is the truthful, the trusted, said to us:
إِنَّ أَحَدَكُمْ يُجْمَعُ خَلْقُهُ فِي بَطْنِ أُمِّهِ أَرْبَعِينَ يَوْمًا ثُمَّ يَكُونُ فِي ذَلِكَ عَلَقَةً مِثْلَ ذَلِكَ ثُمَّ يَكُونُ فِي ذَلِكَ مُضْغَةً مِثْلَ ذَلِكَ ثُمَّ يُرْسَلُ الْمَلَكُ فَيَنْفُخُ فِيهِ الرُّوحَ وَيُؤْمَرُ بِأَرْبَعِ كَلِمَاتٍ بِكَتْبِ رِزْقِهِ وَأَجَلِهِ وَعَمَلِهِ وَشَقِيٌّ أَوْ سَعِيدٌ فَوَالَّذِي لَا إِلَهَ غَيْرُهُ إِنَّ أَحَدَكُمْ لَيَعْمَلُ بِعَمَلِ أَهْلِ الْجَنَّةِ حَتَّى مَا يَكُونُ بَيْنَهُ وَبَيْنَهَا إِلَّا ذِرَاعٌ فَيَسْبِقُ عَلَيْهِ الْكِتَابُ فَيَعْمَلُ بِعَمَلِ أَهْلِ النَّارِ فَيَدْخُلُهَا وَإِنَّ أَحَدَكُمْ لَيَعْمَلُ بِعَمَلِ أَهْلِ النَّارِ حَتَّى مَا يَكُونُ بَيْنَهُ وَبَيْنَهَا إِلَّا ذِرَاعٌ فَيَسْبِقُ عَلَيْهِ الْكِتَابُ فَيَعْمَلُ بِعَمَلِ أَهْلِ الْجَنَّةِ فَيَدْخُلُهَا
Verily, the creation of each one of you is brought together in his mother’s womb for forty days in the form of seed, then he is a clot of blood for another period, then a morsel of flesh for another period, then there is sent to him the angel who blows the breath of life into him and who is commanded regarding four matters: to write down his means of livelihood, his life span, his actions, and whether he is happy or unhappy. By Allah other than whom there is no god, verily, one of you behaves like the people of Paradise until he is but an arm’s length from it, but that which has been written overtakes him, so he behaves like the people of Hellfire and thus he enters it; and one of you behaves like the people of Hellfire until he is but an arm’s length from it, and that which has been written overtakes him, so he behaves like the people of Paradise and thus he enters it. buk
related by al bukhariy and muslim
إِنَّ أَحَدَكُمْ يُجْمَعُ خَلْقُهُ فِي بَطْنِ أُمِّهِ أَرْبَعِينَ يَوْمًا ثُمَّ يَكُونُ فِي ذَلِكَ عَلَقَةً مِثْلَ ذَلِكَ ثُمَّ يَكُونُ فِي ذَلِكَ مُضْغَةً مِثْلَ ذَلِكَ ثُمَّ يُرْسَلُ الْمَلَكُ فَيَنْفُخُ فِيهِ الرُّوحَ وَيُؤْمَرُ بِأَرْبَعِ كَلِمَاتٍ بِكَتْبِ رِزْقِهِ وَأَجَلِهِ وَعَمَلِهِ وَشَقِيٌّ أَوْ سَعِيدٌ فَوَالَّذِي لَا إِلَهَ غَيْرُهُ إِنَّ أَحَدَكُمْ لَيَعْمَلُ بِعَمَلِ أَهْلِ الْجَنَّةِ حَتَّى مَا يَكُونُ بَيْنَهُ وَبَيْنَهَا إِلَّا ذِرَاعٌ فَيَسْبِقُ عَلَيْهِ الْكِتَابُ فَيَعْمَلُ بِعَمَلِ أَهْلِ النَّارِ فَيَدْخُلُهَا وَإِنَّ أَحَدَكُمْ لَيَعْمَلُ بِعَمَلِ أَهْلِ النَّارِ حَتَّى مَا يَكُونُ بَيْنَهُ وَبَيْنَهَا إِلَّا ذِرَاعٌ فَيَسْبِقُ عَلَيْهِ الْكِتَابُ فَيَعْمَلُ بِعَمَلِ أَهْلِ الْجَنَّةِ فَيَدْخُلُهَا
Verily, the creation of each one of you is brought together in his mother’s womb for forty days in the form of seed, then he is a clot of blood for another period, then a morsel of flesh for another period, then there is sent to him the angel who blows the breath of life into him and who is commanded regarding four matters: to write down his means of livelihood, his life span, his actions, and whether he is happy or unhappy. By Allah other than whom there is no god, verily, one of you behaves like the people of Paradise until he is but an arm’s length from it, but that which has been written overtakes him, so he behaves like the people of Hellfire and thus he enters it; and one of you behaves like the people of Hellfire until he is but an arm’s length from it, and that which has been written overtakes him, so he behaves like the people of Paradise and thus he enters it. buk
related by al bukhariy and muslim