Lady Luck must be Uncle Sam’s cousin, because taxes must be paid on all gambling winnings.

Here’s a look at the federal tax forms you’ll need in order to share your wagering good fortune with the IRS. And if you lost a few rounds before your numbers came up, there’s a way you can turn those losses to your tax advantage.

Winning amounts matter

For recreational gamblers, requirements for reporting and withholding from a winning bet depend on the type of gambling, the amount won and the ratio of the winnings to the wager.

When you pocket $600 or more (and that amount is 300 times your bet) at a horse track, win $1,200 at a slot machine or bingo game, or take $1,500-plus in keno winnings, the payer must get your Social Security number and let the IRS know you came into the extra income.

And while poker aficionados argue that playing a card game isn’t gambling, but a game of skill, the IRS still wants details on how well you played Texas Hold ’em. The IRS now requires all poker tournament sponsors to report competitors’ winnings of more than $5,000.

The bottom line is if you are lucky enough to rake in a decent jackpot on a gambling transaction, you’ll have to give the IRS your tax information and, in many cases, you’re not going to walk away with all the cash you won.

In addition to telling Uncle Sam you were a winner and how much you won, the payer in these situations generally will reduce your payout by withholding federal taxes at the 25% rate. If you try to shortchange the IRS by refusing to furnish your Social Security number, the payer could take as much as 28% of your winnings right off the top to send to the tax collector.

In either instance, you’ll get a Form W-2G showing the amount you won and, if applicable, how much in taxes you paid on it upfront.

When you have to report it

Even if you didn’t win enough to trigger W-2G filing, you do want to be a diligent taxpayer and report those gambling winnings, right? The casino, track or lottery agent might not have reported that $25 you won, but it’s still taxable income. It’s ultimately the taxpayer’s responsibility to tell Uncle Sam about his good fortune.

You report your winnings — from the W-2G or those smaller jackpots — on line 21, Other Income, of Form 1040. In addition to gambling proceeds, this is where you’d report any prizes or awards (cash or the cash value of merchandise) you won. All this money goes toward your total income amount.

However, you don’t have to pay taxes on all your earnings, regardless of how you got them. You can reduce the amount of money the IRS will tax by reporting your losses as part of your overall itemized deductions. Check out line 28, Other Miscellaneous Deductions, on Schedule A. That’s where you report any gambling losses. You can claim up to the total amount of winnings you entered on your 1040, effectively wiping out any taxable gambling income.

But make sure this deduction, along with your other itemizations, is more than the standard amount. You always want to use the method that will provide you a bigger deduction.

Even though technically you might be able to avoid taxes on $3,000 you won by claiming $3,000 in bad bets, that’s still less than the standard deduction of $6,300 allowed a single taxpayer on 2015 returns and 2016 income. If you have no other deductions to itemize, it doesn’t make sense to forfeit the standard deduction’s other $3,300 just because you can claim gambling losses.

If, however, your wagering losses are large enough to help boost your already substantial itemized deductions, then fill out the Schedule A.

Keep track of your gaming losses

When you do claim your gambling losses on your tax return, it’s a good idea to keep a record of them. While you don’t have to send your loss data in with your return, documentation could come in handy if the IRS ever questions the claim.

Acceptable gambling-loss record keeping includes a written log detailing the date of your wagers, the location, amount of the bet, type of gaming, and wins and losses. You should also hang on to losing lottery tickets or bingo cards.

The good thing about deducting gambling losses is that, unlike some other deductions, you don’t have to meet a certain level before you can claim them. But then again, they aren’t completely unlimited.

You can count in losses only as much as you won. So if you spent $100 on lottery tickets and won $75, you can deduct only $75. The other $25 is just part of the price of playing the game.