Home appraised before renting for $820k. If it sells for $920k is agent comm, legal fees, & mortgage discharge fees tax deductible? What will be total capital gains tax?

The home was my primary residence for 3 years and I rented it for 1.5 years. Before rending I had it appraised for $820,000.  If it sells for $920,000, are agent commission fees (both buyers and sellers) that I will pay, Legal fees, and Mortgage discharge penalty (3 month interest) tax deductible? What will be my total capital gains tax?