[for a male] إِنَّ لِلهِ مَا أَخَذَ ، وَلَهُ مَا أَعْطَى ، وَكُلُّ شَيْءٍ عِنْدَهُ بِأَجَلٍ مُسَمًّى ..... فَلْتَصْبِرْ وَلْتَحْتَسِبْ
*أَعْظَمَ اللهُ أَجْرَكَ ، وَأَحْسَنَ عَزَاءَكَ ، وَغَفَرَ لِمَيِّتِكَ
[for a female] إِنَّ لِلهِ مَا أَخَذَ ، وَلَهُ مَا أَعْطَى ، وَكُلُّ شَيْءٍ عِنْدَهُ بِأَجَلٍ مُسَمًّى ..... فَلْتَصْبِرِي وَلْتَحْتَسِبِي
*أَعْظَمَ اللهُ أَجْرَكِ ، وَأَحْسَنَ عَزَاءَكِ ، وَغَفَرَ لِمَيِّتِكِ
Indeed, to Allah belongs what He took, and to Him belongs what He gave, and everything with Him has an appointed time. …and then the Prophet (peace and blessings of Allah be upon him) ordered for her "to be patient and hope for Allah’s reward". The words (fal-taṣbir wal-taḥtasib) are commands in the feminine (Third person) form, so they should be changed with respect to whom it is being addressed, so, for a female it would be (fal-taṣbiree wal-taḥtasibee).
*One can also say: May Allah magnify your reward, make better your solace and forgive your deceased. (This is the saying of some of the scholars, not a hadith).
inna lillaahi maa akhadha, wa lahu maa a‛ṭaaa, wa kullu shay’in ‛indahu bi ajalin musam-an.... ...fal-taṣbir wal-taḥtasib (or fal-taṣbiree wal-taḥtasibee -for a female)
[for a male] * a‛ẓam-allaahu ajraka, wa aḥsana ‛azaa’aka, waghafara li mayyitika
[for a female] * a‛ẓam-allaahu ajraki, wa aḥsana ‛azaa’aki, waghafara li mayyitiki