I wanted to sell my flat and wanted to understand how to avail tax exemption on capital tax gain

Dear Sir, I own 2 flats in Bengaluru, 1 flat bought under gram panchayat limit with e Khata ( during Jan 2015) at sale deed price 9,75,500 which is owned jointly along with my wife as secondary owner. The other flat which I bought during 29/09/2021 with sale deed value 53,02,000 value which is single owner on my name. Currently both property on Housing loan SBI and LIC respectively. I am planning sell the first property which we bought in 2015 Jan and selling at the 4000000 sale deed value. I would like get expert advise on below doubts; 1. as per my calculation I have to pay around 5,30,000 capital gain tax (2023-24) it would reduce my gain out of this deal and is it advisable to proceed or should I rent it out which I may get around 15K in hand post maintenance deduction 2. what options I can choose to get maximum tax exemption 3. will my existing loan on property 1 which is 20L (outstanding amount) will help in saving tax. 4. My wife recently looking buy a residential plot will that help please guide me whether i need to go ahead with this deal or give it for rent rather loosing capital gain