How does Qualified Opportunity Zone investment affect MAGI?

I'm looking at placing some real estate capital gains in a qualified opportunity zone investment. Example: I have 400K in capital gains. I place all 400K in an QOZ investment within 180 days and I account for it with the correct filing etc.

 

1.  How would this show up on my final MAGI number? I think a 1031 exchange would show the capital gains as never having been received, so no MAGI increase. What does the OZ look like on MAGI? Would it show my 400K capital gain + my regular income combined and my OZ filing just means that 400K just isn't taxable (until 2026)?  

 

2. Timing. I see a great QOZ investment I want to jump on before it closes to funding, but the capital gain I want to offset doesn't hit until days later. Can I "pre-invest" that sum? In other words, does timing matter? Must QOZ always follow gain?  Or does it just need to happen in the same tax year?  How would the IRS even know? I hope that question makes sense.  

 

Thanks for your help! 

P