You generally cannot claim an exemption for a dependent that files a joint tax return. However, if the dependent files a joint return only in order to claim a refund of taxes withheld, and neither of the spouses would otherwise have to file a return and would not owe any taxes if they filed separate returns, you can claim an exemption.
4. Gross Income Test
In order to claim an exemption, the dependent must not have had gross income of over a cetain amount, which is generally the same amount as the exemption. This amount is published by the IRS each year. There are exceptions for:
Children under age 19 at the end of the year
A student under age 24 at the end of the year
Gross income includes all income in the form of money, property, or services that is not exempt from tax. Tax exempt income, such as social security payments, is not included in gross income.
Certain scholarship and fellowship grants are included in income. But scholarships received by students who are candidates for degrees and that are used to pay tuition, fees, supplies, books, and equipment required for certain courses may be excluded from gross income for this purpose.