The home sale exclusion lets you omit from gross income up to $250,000 of gain ($500,000 on a joint return), but only if you meet certain conditions:
This is generally adjusted gross income increased by certain items such as tax-free foreign earned income. MAGI usually is used to determine phaseouts of certain deductions and credits.