What is the best time to pray Isha; as soon as the azaan is given or just before midnight?
“Isha prayer must be performed before midnight, and it is not permissible to delay it until midnight, because the Prophet (ﷺ) said:
“The time of ‘Isha is until midnight.”
So you have to pray it before midnight, based on the length of the night, because the night may be longer or shorter; therefore the guideline is how many hours the night lasts. If the night is ten hours long, then it is not permissible to delay it until the end of the fifth hour. The best way is to pray it in the first third of the night. If a person prays it at the beginning of the time for ‘Isha, that is OK, but if he delays it a little while, that is preferable, because the Messenger used to recommend delaying Isha prayer for a little while. But if someone prays it at the beginning of its time, after the twilight – the reddish afterglow along the horizon – has vanished, there is nothing wrong with that. And Allah knows best.” 
This means that it is preferred to perform Isha after a third of the night has passed by. The optional time is the time between the start of the time for Isha and the end of the time. The obligatory time is the time just before the time expires, i.e., the time in which it is sufficient to pray before the time ends or expires because if the time expires one would be guilty of the sin of delaying prayer.
The last third of the night is recommended for tahajjud or qiyamul layl so it is not the recommended time for Isha.
 [Narrated by Muslim,al-Masaajid wa Mawaadi’ al-Salaah, 964]
 [Majmoo’ah Fataawa al-Shaykh ‘Abd al-‘Azeez ibn Baaz, 10/386]< Back to Questions