The Prophet ﷺ used to teach us the Istikhara for each and every matter as he used to teach us the Suras from the Holy Quran, he would say, "If anyone of you intends to do something, he should offer a two-rakah prayer other than the obligatory prayer, and then 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-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 raḍḍ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 the 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).
كَانَ النَّبِيُّ ﷺ يُعَلِّمُنَا الاِسْتِخَارَةَ فِي الأُمُورِ كُلِّهَا كَالسُّورَةِ مِنَ الْقُرْآنِ إِذَا هَمَّ بِالأَمْرِ فَلْيَرْكَعْ رَكْعَتَيْنِ ثُمَّ يَقُولُ:
«(اللَّهُمَّ إِنِّي أَسْتَخِيرُكَ بِعِلْمِكَ، وَأَسْتَقْدِرُكَ بِقُدْرَتِكَ، وَأَسْأَلُكَ مِنْ فَضْلِكَ الْعَظِيمِ؛ فَإِنَّكَ تَقْدِرُ وَلاَ أَقْدِرُ، وَتَعْلَمُ وَلاَ أَعْلَمُ، وَأَنْتَ عَلاَّمُ الْغُيُوبِ؛ اللَّهُمَّ إِنْ كُنْتَ تَعْلَمُ أَنَّ {هَذَا الأَمْرَ} خَيْرٌ لِي فِي دِينِي وَمَعَاشِي وَعَاقِبَةِ أَمْرِي،» أَوْ قَالَ «عَاجِلِ أَمْرِي وَآجِلِهِ، فَاقْدُرْهُ لِي؛ وَإِنْ كُنْتَ تَعْلَمُ أَنَّ {هَذَا الأَمْرَ} شَرٌّ لِي فِي دِينِي وَمَعَاشِي وَعَاقِبَةِ أَمْرِي» أَوْ قَالَ «فِي عَاجِلِ أَمْرِي وَآجِلِهِ، فَاصْرِفْهُ عَنِّي وَاصْرِفْنِي عَنْهُ؛ وَاقْدُرْ لِيَ الْخَيْرَ حَيْثُ كَانَ، ثُمَّ رَضِّنِي بِهِ)
وَيُسَمِّي حَاجَتَهُ»