Short answer
Clean, loose, modest clothes. Men must cover from the navel to the knees and ideally wear full-length clothes with the shoulders covered; women wear full hijab. The Quran tells us to take our adornment at every masjid, so wear your better clothes, especially on Friday, and avoid strong smells like garlic or smoke.
Covering the awrah is fard for prayer. Wearing good, clean clothes to the mosque is mustahabb. Praying in clothes with pictures of living things, or in work clothes one would not wear before respectable people, is makruh. Coming to the mosque with an offensive smell is makruh.
The four schools agree on this.
Explanation
Allah says: take your adornment at every masjid. The Prophet ﷺ encouraged anyone who could to keep a set of clothes for Jumuah besides his work clothes, and he told whoever had eaten garlic or onion to keep away from the mosque. Together these give the manners of mosque dress: covered, clean, presentable and fresh.
- Men: a thobe or kurta, or a shirt with trousers that stay below the knee when you prostrate. Cover your shoulders. A cap is a good habit but not required; see covering the head. Avoid shorts, tight trousers and shirts with pictures or slogans.
- Women: loose clothes covering everything except the face, hands and, in the Hanafi school, the feet, with a headscarf; see the hijab guide and women in the mosque.
- Everyone: clean socks, since shoes come off at the door, and a light, pleasant scent rather than a heavy one.
Visitors who are not Muslim are welcome. Men should wear long trousers and a top with sleeves. Women should wear loose clothes covering the arms and legs, and a scarf over the hair; many mosques keep spare scarves at the door. You will be asked to take off your shoes.
For Friday, see how to pray Jumuah, and for smells, going to the mosque after smoking or eating garlic. The four schools agree on these manners.
The evidence
Quran, Surah Al-A'raaf 7:31
۞ يَٰبَنِىٓ ءَادَمَ خُذُوا۟ زِينَتَكُمْ عِندَ كُلِّ مَسْجِدٍۢ وَكُلُوا۟ وَٱشْرَبُوا۟ وَلَا تُسْرِفُوٓا۟ ۚ إِنَّهُۥ لَا يُحِبُّ ٱلْمُسْرِفِينَ ﴿٣١﴾
O children of Adam, take your adornment at every masjid, and eat and drink, but be not excessive. Indeed, He likes not those who commit excess.
Believers are told to dress well for the mosque and prayer, without excess.
Sunan Abi Dawud 1078
Grading to be checked... أن يتخذ ثوبين ليوم الجمعة سوى ثوبي مهنته ...
"...that he keep two garments for Friday besides his two work garments."
Encourages special clean clothes for the Friday prayer.
Sahih al-Bukhari 855
Sahih... من أكل ثوما أو بصلا فليعتزلنا ...
"Whoever has eaten garlic or onion should keep away from us."
Bad smells are kept out of the mosque.
Where the ruling is recorded
- al-Durr al-Mukhtar with Radd al-Muhtar, Kitab al-Salah, chapter on what is disliked in prayer. Praying in work clothes or clothes with pictures is disliked.
- Nur al-Idah with Maraqi al-Falah, Chapter on the conditions of prayer. The awrah of men and women in prayer.
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.