The Messenger of Allah ﷺ used to teach us the way of doing istikhārah (seeking Allah's help while making a choice), in all matters as he taught us the Surahs of the Quran. He said, "If anyone of you is concerned regarding a matter, he should offer a two-rakʿah Ṣalāh outside of the obligatory ones and should say:
allāhumma inni astakhīruka bi-ʿilmika, wa-astaqdiruka bi-qudratika, wa-asʾaluka min fadlik al-ʿaẓīm, fa-innaka taqdiru wala aqdiru, wa-taʿlamu wa-la aʿlamu, wa anta ʿallām al-ghuyūb.
allāhumma in kunta taʿlamu anna {hādhā al-amra} khayrun lī fī dīni wa-maʿāshī wa-ʿāqibati amrī," or said, "fi ʿājili amrī wa-ājilihī, fa-uqdurhu lī wa-yassirhu lī, thumma bārik lī fīh; wa-in kunta taʿlamu anna {hādhā al-amra} sharrun lī fī dīni wa-maʿāshī wa-ʿāqibati amrī," or said, "fī ʿājili amri wa-ʿājilihī fa-iṣrifhu ʿannī wa-iṣrifnī ʿanhu, wa-uqdur līya al-khayra ḥaythu kāna, thumma arḍini bi-hī.
(O Allah! I seek ˹Your help˺ in making a choice through Your knowledge and seek the ability ˹to do so˺ through Your Power, and I ask You for Your Great Blessings. For You are capable and I am not. You know ˹better˺, and I do not, and You know the ˹matters of the˺ unseen."
O Allah! If You know that {such a matter} is good for me, my religion, my livelihood, and my Hereafter..." or he said, "for my short-term ˹goals˺ as well as my long-term ˹goals˺, then ordain it for me and make its ˹path˺ easy for me and then bestow Your blessings upon it. If You know that {such a matter} is bad for me, my religion, my livelihood, and for my Hereafter..." or he said, "for my short-term ˹goals˺ as well as my long-term ˹goals˺, then remove it from ˹my path,˺ and remove me from ˹its path˺ and ˹instead˺ ordain for me good, whatever it may be, and let me be content with it.)"
He said: he should name his need (in place of what is mentioned in brackets).