There are two versions of ourselves that we often carry through life. There is the person people know—the person they see at the mosque, at work, at school, at family gatherings, in the community and on social media. And then there is the person who appears when the door closes, the phone is in our hand, the house is quiet and nobody is watching. Which one is the real us? Islam teaches us that our true relationship with Allah is revealed not merely by what we do in front of people, but by what we are willing to do—or refrain from doing—when only Allah can see us.
Allah says: “Whether you speak secretly or openly—He surely knows best what is hidden in the heart.”
Qur'an 67:13
Nothing is truly hidden from Him.
A private act of worship, a secret charity, a tear shed in the darkness of the night, a temptation resisted when nobody would ever know—all of these are known to Allah. And sometimes, the deed that nobody on earth knows about can become one of the most valuable things we carry before Allah.
The story of the three men in the cave
One of the most powerful examples comes from a hadith narrated by Ibn Umar رضي الله عنهما and recorded in Sahih al-Bukhari. Three men from an earlier nation were travelling when rain forced them to seek shelter inside a cave. Suddenly, a huge rock rolled down the mountain and completely blocked the entrance. They were trapped. They realised that their own strength could not move the rock. So they said to one another that they should call upon Allah by mentioning sincere good deeds they had done for His sake.
The first man remembered something he had done for his elderly parents. Every evening, he would milk his sheep and bring the milk to his parents before giving it to his wife and children. One night he returned late and found his parents already asleep. His children were crying from hunger, but he refused to give them the milk before his parents. He stood there holding the bowl, waiting for his parents to wake. They did not wake until morning. He then asked Allah: If I did this purely out of fear of You, please remove this rock. The rock moved—but they still could not escape.
The second man then remembered another private deed. He had deeply desired a woman who was related to him. She eventually agreed to his advances after he offered her money. But when he was finally in a position to commit the sin, she reminded him: “Fear Allah.”
He immediately stopped. He walked away from the opportunity to commit the sin, despite his desire for her, because he feared Allah. He then asked Allah: If I left that sin purely for Your sake, please remove the rock. The rock moved again. Still, they could not get out.
The third man remembered a matter involving a worker whose wages he had not collected. The man left his wages behind, and the employer invested them until they grew into considerable wealth. When the worker eventually returned, the employer gave him everything that had grown from his original wages. He then called upon Allah, saying that if he had done this sincerely for His sake, Allah should remove the remaining obstruction. The rock moved completely. The three men walked out of the cave.
Think about what is extraordinary about this story. The first man's deed was something done quietly for his parents. The second man's deed was something he chose not to do when he could have done it. The third man's deed involved honesty and giving someone what was rightfully theirs. None of these deeds were performed for an audience. Yet when these men were trapped and desperate, their sincere private deeds became something they could place before Allah in their supplication.
The Sin You Refuse When Nobody Knows
There is something particularly powerful about the second man in the cave. He did not merely perform a good deed. He abandoned a sin. There are moments when a person can do something wrong and be almost certain that nobody will ever discover it. No parents will know. No spouse will know. No friend will know. No reputation will be damaged. But the believer remembers: Allah knows.
The Qur'an gives us another extraordinary example in the story of Prophet Yusuf عليه السلام.
When Yusuf was alone with the woman who attempted to seduce him, the circumstances appeared to favour the sin. Yet he refused and sought refuge in Allah. The Qur'an records:
“He said, ‘I seek refuge in Allah.’”
Qur'an 12:23
His choice was made when the temptation was private. That is taqwa. It is easy to behave properly when everyone is watching. The greater test can come when nobody is. The Prophet ﷺ specifically mentioned such a person among those who will receive Allah's special shade on the Day of Resurrection: a man who is invited to commit an unlawful sexual act but says: “I fear Allah.”
The same hadith mentions another person who gives charity so secretly that his left hand does not know what his right hand has given, and another who remembers Allah while alone and weeps.
Notice the connection. A private temptation resisted. A private charity given. A private remembrance of Allah. These are not insignificant moments.
Allah Knows the Charity Nobody Else Knows About
Sometimes we think charity becomes meaningful when people see us giving. Islam teaches something very different. Allah says: “Those who spend their wealth by night and by day, secretly and publicly—their reward is with their Lord. There will be no fear for them, nor will they grieve.”
Qur'an 2:274
The verse explicitly mentions secretly and publicly. A person might quietly transfer money to someone struggling. They might pay someone's debt without telling them who did it. They might leave food outside someone's door. They might help an elderly neighbour with groceries. They might quietly contribute to a mosque or a child's education. Perhaps nobody ever thanks them. Perhaps nobody ever even knows. But Allah knows. And that is enough.
The Nighttime Deeds Nobody Sees
There is another kind of private worship that can transform a person's relationship with Allah. Imagine a person who wakes up while everyone else is asleep. No audience. No photograph. No social media post. No one will congratulate them. They make wudu, stand before Allah and pray. Perhaps they are exhausted. Perhaps they have been carrying worries that they have told nobody about. Perhaps they simply stand there because they want to be close to their Creator. The Prophet ﷺ described among those receiving Allah's shade: “A person who remembers Allah in seclusion and his eyes overflow with tears.”
Sahih al-Bukhari 6479
That tear may last only a few seconds. But Allah sees it.
A sin you could do without anyone knowing
Know Consider a very ordinary situation. It is late at night. Your family is asleep. You are alone with your phone. You come across something you know you should not look at.
You could continue. Nobody in your home would know. You could delete your browsing history afterwards. There would be no public embarrassment and perhaps no immediate consequence. But then you remember Allah. You close the screen. You put the phone down. You walk away. The world may never know that moment happened. But Allah knows.
And perhaps that moment of restraint is more valuable to you than a public act that received a hundred compliments—because you were not protecting your reputation. You were protecting your relationship with Allah.
The Danger of Living for People's Eyes
There is also a warning hidden inside this subject. If we only behave well when people are watching, we can slowly become more concerned with appearing righteous than actually being righteous. We may become careful about our public image while neglecting our private relationship with Allah. But, subhanallah, Allah is not deceived by appearances.
The Prophet ﷺ said: “Allah does not look at your bodies or your forms, but He looks at your hearts and your deeds.”
Sahih Muslim 2564
The real question, therefore, is not: “What do people think of me?”
The real question is: “What does Allah know about me?”
Build a Secret Relationship With Allah
Perhaps every Muslim should have deeds that nobody else knows about. A private charity. A prayer that nobody knows we regularly perform. A few minutes of Qur'an before everyone wakes. A secret dhikr while walking. A sincere du'a made in the darkness. A sin we repeatedly refuse because we fear Allah. A person we forgive without telling anyone. A needy person we help anonymously. These hidden deeds become something deeply personal between the servant and his Lord. And the story of the three men in the cave gives us a remarkable lesson: a sincere deed done in private may become a source of help when we need Allah most.
We should not think of these deeds as transactions with Allah—as though we are doing good merely so that we can demand something in return. Rather, the story shows the power of sincere deeds and the mercy of Allah when His servants call upon Him through what they genuinely did for His sake.
So, Who Are You When Nobody Is Watching?
Perhaps that is one of the most important questions a believer can ask. Who are you when you are alone? Who are you when nobody can praise you? Who are you when nobody can shame you? Who are you when you could commit a sin and walk away without anyone ever knowing? Who are you when you can do something good and receive absolutely no recognition? That person is worth examining. Because the people around us see our faces. They hear our words. They see our public actions. But Allah sees what happens when the doors close.
He sees the charity nobody knows about. He sees the temptation you resisted. He sees the prayer you made when everyone else was sleeping. He sees the tears you wiped away before anyone could notice. He sees every struggle between what you want and what you know is right.
And perhaps one day, when we stand before Him with nothing left to hide, we will discover that some of the deeds we thought were too small to matter were among the greatest treasures we possessed. So let us build a life that is beautiful both in public and in private. Let us have deeds that belong only to Allah. Because when nobody else is watching—
Allah is. And for the believer, Allah being there is enough.