Imam al-Ghazali says that there is an outward and inward fasting. The outward pertains to making sure that the basics are observed, namely, abstaining from consuming anything or having sexual intimacy with one’s spouse. The inward is about making sure that the fast is acceptable to God.
The Prophet ﷺ said that there are many people who fast but gain nothing from it except hunger and thirst. Outwardly, their fast seems fine, but inwardly they break their fast with such things as backbiting, lustful glances, lies, and other violations of the inward fast.
Shaykh Hamza Yusuf