Short answer
It depends. A graduation is a one-time blessing, and thanking Allah with a meal, gifts or a gathering free of haram is permitted. Yearly anniversaries are treated like birthdays: the mainstream Hanafi fatwa advises against making them a fixed annual celebration, while some scholars allow a simple family meal as custom.
Showing gratitude for a blessing such as graduating, with a meal, gifts and dua, is permitted. Fixing a yearly celebration for a wedding anniversary is discouraged in the mainstream Deobandi fatwa, as it adds annual festivals and imitates others. Kindness and gifts to a spouse on any day are good.
The four schools agree on this.
Explanation
Allah says: if you are grateful, I will surely increase you. Marking a real blessing such as finishing a degree, passing an exam or a new job with thanks to Allah, a meal with family, sadaqah and gifts is a good thing. The Companions fed people on happy occasions, and giving gifts is sunnah.
Yearly anniversaries are different. When the Prophet ﷺ came to Madinah he found people with two yearly festivals, and said Allah had replaced them with something better: Eid al-Adha and Eid al-Fitr. The Hanafi muftis took from this that Muslims should not set up their own annual celebrations, and they apply the same ruling to birthdays and wedding anniversaries. See are birthdays haram. Other scholars see a wedding anniversary as a custom with no religious meaning, and allow a simple dinner or gift between spouses.
Practical points:
- Graduation: attending your ceremony is fine. Keep your awrah covered, avoid mixed dancing and music at the party, and thank Allah first.
- Graduation gowns and caps: these are academic dress, not religious symbols, so wearing them is fine.
- Anniversaries: rather than a fixed annual party, surprise your spouse with a gift or a meal on an ordinary day. Love that is shown all year is closer to the sunnah.
- Work anniversaries: a thank-you card or lunch from colleagues is simply kindness.
Whatever you do, avoid what is haram on its own: music, mixing, alcohol, waste and showing off. For other occasions, see holidays Muslims celebrate.
The evidence
Quran, Surah Ibrahim 14:7
وَإِذْ تَأَذَّنَ رَبُّكُمْ لَئِن شَكَرْتُمْ لَأَزِيدَنَّكُمْ ۖ وَلَئِن كَفَرْتُمْ إِنَّ عَذَابِى لَشَدِيدٌۭ ﴿٧﴾
And [remember] when your Lord proclaimed, 'If you are grateful, I will surely increase you [in favor]; but if you deny, indeed, My punishment is severe.' "
Thanking Allah for blessings is commanded and rewarded.
Sunan Abi Dawud 1134
Graded sahih... قد أبدلكم الله بهما خيرا منهما يوم الأضحى ويوم الفطر ...
"Allah has given you something better than them: the day of Adha and the day of Fitr."
The basis for not adding new yearly festivals.
Sunan Abi Dawud 4031
Graded hasan sahih... من تشبه بقوم فهو منهم ...
"Whoever imitates a people is one of them."
Used by the Hanafi muftis on adopting other peoples' customs.
Where the ruling is recorded
- Fatawa Mahmudiyya, Chapter on customs and innovations. Annual celebrations of birthdays and similar days are discouraged.
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.