The best words to say when offering condolences
Question

Are there specific words to be said when offering condolences?
Praise be to Allah.Offering condolences means encouraging the bereaved to show patience. There are no specific words for that, but the best is to offer condolences in the phrases with which the Prophet (blessings and peace of Allah be upon him) offered condolences.
Imam ash-Shafa‘i (may Allah have mercy on him) said: There are no specific words for offering condolences."(Al-Umm  1/317).
Ibn Qudamah (may Allah have mercy on him) said: We do not know of any specific words for offering condolences…"(Al-Mughni  2/212).
Shaykh Ibn Baz (may Allah have mercy on him) said: There are no specific phrases for offering condolences; rather the Muslim may offer condolences to his brother with whatever appropriate words he can, such as saying: “May Allah comfort you, compensate your loss and forgive your deceased loved one,” if the deceased was a Muslim."(Majmu‘ al-Fatawa  13/380).
Shaykh al-Albani (may Allah have mercy on him) said: He may offer condolences to them in whatever words he thinks will comfort them, help them to cope with their grief and encourage them to be content and patient, from words that have been soundly narrated from the Prophet (blessings and peace of Allah be upon him), if he knows them and can call them to mind. Otherwise, he may say whatever he can of kind words that will achieve the purpose and are not contrary to Islamic teachings."(Ahkam al-Jana’iz  1/163).
The best is to offer condolences to the bereaved person in the words in which the Prophet (blessings and peace of Allah be upon him) offered condolences to his daughter, by saying: “To Allah belongs that which He has taken, and to Him belongs that which He has given, and everything has an appointed time with Him. Tell her to be patient and seek reward.” Narrated by al-Bukhari (1284) and Muslim (923).
It says in al-Jawharah an-Nayyirah (1/110): The wording for offering condolences is “May Allah multiply your reward, comfort you, forgive your deceased loved one, help you to be patient, and reward us and you immensely for patience.” Better than that is the words with which the Messenger of Allah (blessings and peace of Allah be upon him) offered condolences to one of his daughters whose son was dying. He said: “Inna Lillahi ma akhadha, wa lahu ma a‘ta, wa kullu shay’in ‘indahu bi ajalin musamma (Indeed to Allah belongs what He has taken, to Him belongs what He has given, and everything has an appointed time with Him).” End quote.
Shaykh al-Albani (may Allah have mercy on him) said: Although this wording for offering condolences was narrated concerning one who was about to die, offering condolences in these words regarding one who has already died is more appropriate, as the wording of the text indicates. Hence an-Nawawi said in al-Adhkar and elsewhere: This hadith contains the best words of condolence."(Ahkam al-Jana’iz  1/164).
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) said: The best wording for offering condolences is the wording with which the Prophet (blessings and peace of Allah be upon him) offered condolences to one of his daughters… Then he quoted the hadith mentioned above.
Then he said: As for the words that are well known among people, “May Allah multiply your reward, comfort you, and forgive your deceased loved one,” these are words that were preferred by some of the scholars, but what is mentioned in the Sunnah is more appropriate and is better."(Majmu‘ al-Fatawa  17/339).
And Allah knows best.