The hadith
Narrated by Abū Hurayrah, the Messenger of Allah ﷺ said:
مَنْ قَالَ: سُبْحَانَ اللهِ وَبِحَمْدِهِ، فِي يَوْمٍ مِئَةَ مَرَّةٍ، حُطَّتْ عَنْهُ خَطَايَاهُ، وَإِنْ كَانَتْ مِثْلَ زَبَدِ البَحْرِ
"Whoever says: Subḥān Allāhi wa biḥamdih one hundred times in a day, his sins will be removed from him, even if they are like the foam of the sea."
This wording is recorded by al-Bukhārī and Muslim.
Meaning of the phrase
"Like the foam of the sea" (مِثْلَ زَبَدِ البَحْرِ) is an expression of extreme abundance — sins so many they seem countless.
A related post-prayer wording
An authentic wording for the dhikr after the prescribed prayers says: whoever says Subḥān Allāh 33 times, al-ḥamdu lillāh 33 times, Allāhu akbar 33 times, then completes one hundred with:
لَا إِلَهَ إِلَّا اللهُ وَحْدَهُ لَا شَرِيكَ لَهُ، لَهُ المُلْكُ وَلَهُ الحَمْدُ وَهُوَ عَلَى كُلِّ شَيْءٍ قَدِيرٌ
lā ilāha illā Allāh waḥdahu lā sharīka lah, lahu-l-mulku wa lahu-l-ḥamd, wa huwa ʿalā kulli shayʾin qadīr
— his sins are forgiven even if they are like the foam of the sea.
Scholarly qualification
Scholars commonly qualify this expiation as applying to minor sins, while major sins require sincere repentance (tawbah). Although the outward wording of the hadith is general, the majority of scholars restrict it by the condition of avoiding major sins.