Short answer
Yes. Your Islam is valid whether or not anyone knows, and you may keep it private while you prepare, especially if telling people could bring real harm such as violence or losing your home. You still pray and keep the duties you can manage quietly, and you must not deny Islam or join other worship unless you are truly forced.
Faith is belief in the heart and affirmation by the tongue; announcing it to others is not a condition. Concealing one's Islam out of a real fear of harm is permitted, and a person forced under threat of death or serious injury to say words of disbelief, with a heart firm in faith, is excused. The duties of Islam, such as the five prayers, remain and may be done privately.
The four schools agree on this.
Explanation
The Quran praises a believing man from the family of Pharaoh who concealed his faith and still spoke up for Moses. The first Muslims in Makkah worshipped quietly for years. When Abu Dharr accepted Islam, the Prophet ﷺ told him to keep the matter hidden for now and go back to his people. And the Quran excuses the one who is forced to say words of disbelief while his heart is at peace with faith.
- Prayer: pray on time in your room, an empty office or a quiet corner. Each prayer takes a few minutes, and wudu can be done at any sink.
- Food and drink: decline pork and alcohol with a simple, honest reason, such as I don't eat that.
- Ramadan: fasting may be hard to hide. Do what you can and ask a mufti about your situation.
- Family events: you can attend, but do not join church prayers or other worship.
- If asked directly: you do not have to announce your faith, but do not deny Islam unless you face real coercion.
Secrecy is meant for a season, not for life. Use the time to learn, find a few trusted Muslim friends, and plan how to tell your family gently when it is safe. See how to tell your family and treating non-Muslim parents.
If you are married, or a woman married to a non-Muslim man, your situation has extra rulings; speak to a mufti privately. If you face abuse or threats, contact the authorities or a support service. Allah sees your heart, and small deeds done steadily are the most beloved to Him.
Ask a mufti about your own case. This answer explains the general ruling. When the details of your situation matter, as they do here, ask a qualified mufti and give them the full facts. Where to ask a scholar.
The evidence
Quran, Surah Ghafir 40:28
وَقَالَ رَجُلٌۭ مُّؤْمِنٌۭ مِّنْ ءَالِ فِرْعَوْنَ يَكْتُمُ إِيمَٰنَهُۥٓ أَتَقْتُلُونَ رَجُلًا أَن يَقُولَ رَبِّىَ ٱللَّهُ وَقَدْ جَآءَكُم بِٱلْبَيِّنَٰتِ مِن رَّبِّكُمْ ۖ وَإِن يَكُ كَٰذِبًۭا فَعَلَيْهِ كَذِبُهُۥ ۖ وَإِن يَكُ صَادِقًۭا يُصِبْكُم بَعْضُ ٱلَّذِى يَعِدُكُمْ ۖ إِنَّ ٱللَّهَ لَا يَهْدِى مَنْ هُوَ مُسْرِفٌۭ كَذَّابٌۭ ﴿٢٨﴾
And a believing man from the family of Pharaoh who concealed his faith said, "Do you kill a man [merely] because he says, 'My Lord is Allah' while he has brought you clear proofs from your Lord? And if he should be lying, then upon him is [the consequence of] his lie; but if he should be truthful, there will strike you some of what he promises you. Indeed, Allah does not guide one who is a transgressor and a liar.
Concealing faith out of fear is shown in the Quran without blame.
Quran, Surah An-Nahl 16:106
مَن كَفَرَ بِٱللَّهِ مِنۢ بَعْدِ إِيمَٰنِهِۦٓ إِلَّا مَنْ أُكْرِهَ وَقَلْبُهُۥ مُطْمَئِنٌّۢ بِٱلْإِيمَٰنِ وَلَٰكِن مَّن شَرَحَ بِٱلْكُفْرِ صَدْرًۭا فَعَلَيْهِمْ غَضَبٌۭ مِّنَ ٱللَّهِ وَلَهُمْ عَذَابٌ عَظِيمٌۭ ﴿١٠٦﴾
Whoever disbelieves in Allah after his belief... except for one who is forced [to renounce his religion] while his heart is secure in faith. But those who [willingly] open their breasts to disbelief, upon them is wrath from Allah, and for them is a great punishment;
A believer forced to deny Islam under threat is excused.
Sahih al-Bukhari 3522
Sahih... يا أبا ذر اكتم هذا الأمر وارجع إلى بلدك ...
"O Abu Dharr, keep this matter hidden and go back to your land."
The Prophet ﷺ allowed a new Muslim to conceal his Islam for a time.
Sahih al-Bukhari 6464
Sahih... أحب الأعمال إلى الله أدومها وإن قل ...
"The deeds most beloved to Allah are the most constant, even if small."
Steady, quiet worship is valued by Allah.
Where the ruling is recorded
- al-Hidaya, Kitab al-Ikrah. One forced under threat to life or limb may utter words of disbelief while his heart is firm in faith.
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.