Turning a profit in the oil and gas business isn’t a straightforward proposition. Most individual investors in the energy market hold interests in limited partnerships, and this can be risky for anyone who lacks experience in this area. But with such risks comes the chance to take advantage of unique tax benefits that apply to oil and gas investments.

You may be able to qualify for deductions for drilling costs, depletion deductions, and low taxes on profits when you sell your interests.

1. Drilling cost deductions. You may be able to take deductions for “intangible” and “tangible” drilling costs. Intangible drilling costs (IDCs) are related to drilling expenses such as labor, fuel, chemicals, hauling, and other costs that usually represent 70% to 85% of the cost of a well. A special tax law provision allows a current deduction for IDCs paid before the end of the year, as long as the drilling begins within 90 days after the close of the tax year and certain other technical requirements are met.

Tangible drilling costs—including expenses for oil and gas drilling equipment such as casings, pump jacks, and wellheads—generally are capitalized and depreciated over a period of time, limiting your immediate tax benefits.

2. Depletion deductions. “Depletion” for oil and gas investments is the equivalent of depreciation for other kinds of business investments. There are two types: cost depletion and percentage depletion.

Cost depletion, which must be used if the drilling occurs in a proven area, is calculated according to the cost basis of potential oil reserves multiplied by annual production. When you have recovered your basis in such an investment, cost depletion ends. Cost depletion also can be used for drilling in unproven areas. But percentage depletion is another option in such cases. That method allows you to recover costs by deducting a percentage (usually 15%) of the gross income you receive from the well each year. But other tax law restrictions may limit the amount of annual percentage depletion you can claim, and such deductions also may trigger alternative minimum tax (AMT) consequences.

3. Low taxes on profits. If you’ve held an interest in a partnership for more than a year, any profit from its sale normally will be treated as a long-term capital gain and be taxed at a maximum rate of 15%. But there are several reasons you might pay more. To begin with, the long-term gains tax rate is now 20% for single filers with taxable income of more than $400,000 ($406,750 in 2014) and for joint filers with more than $450,000 ($457,600 in 2014). You also might be subject to a new 3.8% Medicare surtax, which applies to whichever is less: your net investment income (NII) or the amount by which your modified adjusted gross income (MAGI) exceeds $200,000 for single filers and $250,000 for joint filers. Income from oil and gas partnerships counts as NII.

Moreover, when you sell your oil and gas investment, your cost basis in the investment is reduced by the amount of the deductions you’ve already claimed—and reducing the basis will have the effect of increasing your taxable profit. In addition, you must “recapture” income to account for depreciation and IDCs you have claimed. The amount subject to recapture is the total amount of the IDC deduction reduced by the amount that would have been deductible had the intangible costs been capitalized and recovered through cost depletion. Other special rules also may apply.

And what if you lose money on an oil and gas deal? Although you can use investment losses to offset taxable income on your federal tax return, the tax law limits loss deductions from “passive activities”—and most investment activities fall into that category. The basic rule is that your losses on passive activities for the year can’t be more than the amount of income those passive activities have generated. If your losses are higher, you’ll have to carry over the excess to the following year.

In some cases, a “working interest” in oil and gas may be exempt from the passive activity rules. However, that’s unlikely to apply to your investment. In general, the tax rules relating to oil and gas interests are extremely complex, and if you’re considering such an investment, it’s essential to work with your tax advisor to make sure you know what is and is not permitted.