Entering the Masjid
اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ
Allahummaftah li abwaba rahmatik.
O Allah, open for me the doors of Your mercy.
What it means
You walk through one door and ask for others to be opened. Inside the masjid what a person needs most is mercy, so that is what is requested at the threshold, before any prayer begins.
When and how
Step in with your right foot first. Many also begin with the name of Allah and blessings on the Prophet ﷺ, then say this dua, then pray two rakahs of greeting the masjid before sitting.
Its virtue
This is what the Prophet ﷺ taught his Companions to say on entering a masjid, reported in Sahih Muslim 713.
Source
Muslim 713sahih