Short answer
Seven, according to the best-known view: three sons, Qasim, Abdullah and Ibrahim, and four daughters, Zaynab, Ruqayyah, Umm Kulthum and Fatimah. All were from Khadijah except Ibrahim, whose mother was Mariyah. His sons died in childhood, and all his children died before him except Fatimah.
The mainstream Sunni account is three sons and four daughters. Some reports count al-Tayyib and al-Tahir as separate sons, but most scholars say these were titles of Abdullah. His descendants come only through Fatimah.
The four schools agree on this.
Explanation
His sons. Qasim was his first child, which is why he was called Abu al-Qasim. Abdullah was born in Makkah; most scholars say al-Tayyib and al-Tahir were his titles. Both died as small children in Makkah. Ibrahim was born in Madinah in 8 AH to Mariyah al-Qibtiyya and died at about eighteen months. When Ibrahim died, the Prophet ﷺ wept and said: "The eye sheds tears and the heart grieves, and we say only what pleases our Lord." He also said Ibrahim had a wet nurse in Paradise.
His daughters. Zaynab married Abu al-As ibn al-Rabi. Ruqayyah married Uthman ibn Affan and died during the Battle of Badr; Uthman then married Umm Kulthum, which is why he was called Dhu al-Nurayn (the one with two lights). Fatimah married Ali ibn Abi Talib and was the only child to outlive him, by six months.
The Quran says: "Muhammad is not the father of any one of your men, but he is the Messenger of Allah and the seal of the prophets" (33:40). Scholars note the wisdom in his sons not reaching manhood: there would be no son to inherit prophethood after the final prophet.
The Prophet ﷺ outlived six of his seven children. His patience in that grief is a comfort to every parent who loses a child. See the family tree, Who was Fatimah in Islam? and Khadijah.
The evidence
Quran, Surah Al-Ahzaab 33:40
مَّا كَانَ مُحَمَّدٌ أَبَآ أَحَدٍۢ مِّن رِّجَالِكُمْ وَلَٰكِن رَّسُولَ ٱللَّهِ وَخَاتَمَ ٱلنَّبِيِّۦنَ ۗ وَكَانَ ٱللَّهُ بِكُلِّ شَىْءٍ عَلِيمًۭا ﴿٤٠﴾
Muhammad is not the father of [any] one of your men, but [he is] the Messenger of Allah and last of the prophets. And ever is Allah, of all things, Knowing.
He left no adult son, and he is the last prophet.
Sahih al-Bukhari 1303
Sahih... إن العين تدمع والقلب يحزن ...
"The eye sheds tears and the heart grieves."
His words at the death of his son Ibrahim.
Sahih al-Bukhari 1382
Sahih... إن له مرضعا في الجنة ...
"He has a wet nurse in Paradise."
His words about Ibrahim.
Sahih al-Bukhari 3538
Sahih... تسموا باسمي ولا تكتنوا بكنيتي ...
"Name yourselves with my name but do not take my kunya."
His kunya Abu al-Qasim, after his first son.
Where the ruling is recorded
- Zad al-Ma'ad (Ibn al-Qayyim), Section on his children. Lists his sons and daughters and the views on their number.
- Sirat Ibn Hisham, Account of the children of the Messenger of Allah from Khadijah. The children born in Makkah.
- al-Isaba fi Tamyiz al-Sahaba (Ibn Hajar), Entries on Zaynab, Ruqayyah, Umm Kulthum and Ibrahim. The life of each child.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.