Short answer
At sunset. The fast ends as soon as the sun has fully set, which is the start of Maghrib time, and it is sunnah to break it straight away rather than wait for darkness. All four schools agree.
The fast ends at sunset (ghurub). Hastening the iftar once you are sure the sun has set is mustahabb (recommended), and delaying it until the stars come out, as if that were part of the religion, is disliked. On a cloudy day, wait until you are reasonably sure the sun has set.
The four schools agree on this.
Explanation
Allah set the end of the daily fast in the Quran: complete the fast until the night. The Prophet ﷺ explained it plainly: when night comes from the east, the day leaves from the west and the sun has set, the fasting person has reached the time to break the fast. So the moment is sunset, not full darkness and not the end of the Maghrib prayer.
Use the Maghrib time. In practice you break the fast at the Maghrib time on a reliable local timetable, or at the adhan of a masjid that calls Maghrib on time. You do not need to watch the sun go down yourself. If you are on a plane or high up and can still see the sun, wait until it has set where you are.
Do not delay. The Prophet ﷺ said people will remain upon good as long as they hasten to break the fast. The Hanafi scholars count this as mustahabb on a clear day. On a cloudy day, or if you are unsure, wait a little until you are confident. If you broke the fast thinking the sun had set and then learned it had not, the fast is broken: stop eating, hold back for the rest of the day and make up one day, with no kaffarah (expiation).
- Break it with fresh or dry dates, or water if you have none. See why Muslims break their fast with dates.
- Say the iftar dua. See the dua for breaking the fast.
- Then pray Maghrib on time. See iftar before or after Maghrib.
The four schools agree that the fast ends at sunset and that hastening the iftar is sunnah. For how long the whole fasting day lasts, see how long Muslims fast each day.
The evidence
Quran, Surah Al-Baqara 2:187
أُحِلَّ لَكُمْ لَيْلَةَ ٱلصِّيَامِ ٱلرَّفَثُ إِلَىٰ نِسَآئِكُمْ ۚ هُنَّ لِبَاسٌۭ لَّكُمْ وَأَنتُمْ لِبَاسٌۭ لَّهُنَّ ۗ عَلِمَ ٱللَّهُ أَنَّكُمْ كُنتُمْ تَخْتَانُونَ أَنفُسَكُمْ فَتَابَ عَلَيْكُمْ وَعَفَا عَنكُمْ ۖ فَٱلْـَٰٔنَ بَٰشِرُوهُنَّ وَٱبْتَغُوا۟ مَا كَتَبَ ٱللَّهُ لَكُمْ ۚ وَكُلُوا۟ وَٱشْرَبُوا۟ حَتَّىٰ يَتَبَيَّنَ لَكُمُ ٱلْخَيْطُ ٱلْأَبْيَضُ مِنَ ٱلْخَيْطِ ٱلْأَسْوَدِ مِنَ ٱلْفَجْرِ ۖ ثُمَّ أَتِمُّوا۟ ٱلصِّيَامَ إِلَى ٱلَّيْلِ ۚ وَلَا تُبَٰشِرُوهُنَّ وَأَنتُمْ عَٰكِفُونَ فِى ٱلْمَسَٰجِدِ ۗ تِلْكَ حُدُودُ ٱللَّهِ فَلَا تَقْرَبُوهَا ۗ كَذَٰلِكَ يُبَيِّنُ ٱللَّهُ ءَايَٰتِهِۦ لِلنَّاسِ لَعَلَّهُمْ يَتَّقُونَ ﴿١٨٧﴾
It has been made permissible for you the night preceding fasting to go to your wives [for sexual relations]. They are clothing for you and you are clothing for them. Allah knows that you used to deceive yourselves, so He accepted your repentance and forgave you. So now, have relations with them and seek that which Allah has decreed for you. And eat and drink until the white thread of dawn becomes distinct to you from the black thread [of night]. Then complete the fast until the sunset. And do not have relations with them as long as you are staying for worship in the mosques. These are the limits [set by] Allah, so do not approach them. Thus does Allah make clear His ordinances to the people that they may become righteous.
The Quran itself sets sunset as the end of the daily fast.
Sahih al-Bukhari 1954
Sahih... وأدبر النهار من ها هنا وغربت الشمس فقد أفطر الصائم ...
"When the day goes from here and the sun has set, the fasting person has broken his fast."
The fast ends with sunset, not with full darkness.
Sahih al-Bukhari 1957
Sahih... لا يزال الناس بخير ما عجلوا الفطر ...
"People will remain upon good as long as they hasten to break the fast."
Breaking the fast promptly at sunset is the sunnah.
Where the ruling is recorded
- al-Hidaya, Kitab al-Sawm, opening chapter. The fast is holding back from eating, drinking and intercourse from true dawn until sunset, with intention.
- Nur al-Idah with Maraqi al-Falah, Kitab al-Sawm, chapter on what is recommended for the fasting person. Hastening the iftar is recommended on a day that is not cloudy.
- Radd al-Muhtar (Ibn Abidin), Kitab al-Sawm, chapter on what breaks the fast and what does not. Whoever breaks the fast thinking the sun has set, when it has not, makes up the day with no kaffarah.
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.