Getting money back on credit card purchases can be very rewarding. For 2019, the best cards include up to 5% back on categories including restaurants and gasoline and hundreds of dollars (or more) in sign-up bonuses.

What’s the catch? There are a few. To maximize rewards, you’ll have to pay attention to which card you use for which purchases. If your credit score isn’t in the high 700s or above, you might not qualify for the best offers (but you might). Some of the most appealing rewards are offered by cards that charge annual fees—though in most cases, those fees are waived in the first year, so you could earn a big initial bonus, use the card for a year and cancel without paying a dime in fees. And cards that offer great rewards often charge steep interest rates on carried balances, so if you do carry a credit card balance, you’re likely better off skipping these cards and selecting a card with a lower interest rate instead.

Here’s a look at more than a dozen credit cards offering valuable perks in 2019. See which would be best for you depending on your spending habits and preferences…

Best cards for eating out: Barclays Uber Visa and Capital One Savor ­Mastercard are locked in a tight race for top honors in this category. Both offer 4% back at restaurants and bars, but from there the offers diverge, and which is best depends on your priorities. Uber Visa offers 3% back on airfare, hotels and vacation rentals…2% back on online purchases…and 1% on ­everything else. (Cardholders earn points, not cash back, but those points can be easily redeemed for cash without any loss of value.) Capital One Savor offers 4% back on entertainment including movies, plays, theme parks, tourist attractions, bowling alleys, sporting events, concerts and more…2% at grocery stores…and 1% on everything else. Savor has been offering the larger initial bonus—you can earn $500 by spending at least $3,000 in the first three months, versus a $100 bonus for spending at least $500 with the Uber card. But the Uber card has no annual fee, while ­Savor has a $95 annual fee (that fee is waived in the first year). Neither card charges foreign-transaction fees.

Bonus: Another nice perk from the Uber card—its smartphone protection coverage is among the best included with any credit card. Many cards now provide compensation when the cardholder’s phone is stolen or damaged (but not lost), but that compensation can be capped as low as $200. The Uber card offers up to $600 coverage per claim, with a low $25 deductible and up to two claims allowed per year. Cardholders must pay their monthly cellular bills with the Uber card to qualify.

Best cards for rotating categories: Discover it and Chase Freedom Visa each offer 5% cash back on up to $1,500 spent in spending categories that change each quarter. With both of these cards, cardholders must register for the 5% category each quarter, but that involves as little as clicking a link in an automated e-mail or text. Cardholders receive 1% back on all other purchases, so it’s best to use other rewards cards for those categories. In at least one quarter every year, each card typically offers 5% back at grocery stores and gas stations. Other common categories include warehouse clubs…department stores…restaurants…and Internet, cable and phone services. Neither card charges an annual fee. One difference between the two: Chase Freedom has been offering an initial bonus of $150 for spending $500 in the first three months, while Discover has offered to double the first year’s rewards at the end of that year.

Best card for supermarket shopping: American Express Blue Cash Everyday or American Express Blue Cash Preferred. Which of these cards is better depends on how much you spend. The Everyday card has no annual fee and offers 3% cash back on up to $6,000 per year in supermarket spending (plus 2% at US gas stations and certain department stores…and 1% on everything else)…while the Preferred card charges a $95 annual fee but pays 6% back on up to $6,000 per year in ­supermarket spending (plus 3% at US gas stations…and 1% on everything else). Preferred’s higher cash-back rate will more than cover its annual fee if you use the card for more than $3,167 in supermarket spending (an average of $264 per month) each year. Preferred has a slightly higher initial bonus as well—$250 for spending $1,000 in the first three months, compared with $150 with Everyday.

Best cards for buying gas: PenFed Platinum Rewards Visa and Costco Anywhere Visa Card by Citi. The PenFed card offers five points for each dollar spent on gas with no limit on how much gas qualifies (plus three points per dollar spent at grocery stores…and one point per dollar on other purchases). The value of these points is impossible to determine exactly because it depends on how you choose to use them—points have different values with different redemption options. Most estimates peg the value at roughly a penny apiece, which would mean about 5% on gas, 3% on groceries and 1% on everything else. But the points are not as versatile as cash—they must be redeemed for rewards such as gift cards at a limited selection of stores or restaurant chains. There’s a $100 initial bonus if you spend $1,500 in the first 90 days. To qualify for this card, you must join the PenFed Credit Union, though all that’s required is a onetime donation of as little as $17 to a designated nonprofit.

If you have a Costco membership, Costco Anywhere Visa is the easier option for gas rewards. It offers 4% cash back on up to $7,000 in gas purchases at Costco and non-Costco stations (plus 3% back at restaurants and on many travel purchases…2% on Costco non-gas purchases…and 1% on everything else). Neither card charges foreign-transaction fees.

Depending on which gas station chain you tend to frequent, you may want to get that chain’s credit card if it offers better rewards than the other cards you have. Example: Marathon Visa is perhaps the best. It offers a 25-cent rebate per gallon in months when your total charges on the card top $1,000 (or 15 cents per gallon when you spend between $500 and $999…or five cents per gallon when you spend less than $500).

Best card for cash back with no complications: Citi Double Cash Mastercard offers 2% back on all purchases all year without limit. There’s no need to worry about spending categories or caps, and there are no annual fees. (Technically, cardholders earn 1% back when they make a purchase and another 1% when they pay the credit card bill.)

Best card for small business: Chase Ink Business Cash Visa offers 5% back on up to $25,000 per year in office-supply stores and on Internet, cable and phone services…2% on up to $25,000 at gas stations and restaurants…and 1% on everything else. There’s also an initial bonus of $500 for spending at least $3,000 in the first three months and no annual fee.

Best cards for students: Discover it Student Cash Back and Journey Student Mastercard from Capital One both have appealing rewards programs, which is rare for cards offered to students who have limited credit histories. Discover it Student is very similar to the Discover it rotating category card discussed earlier—it offers 5% cash back on up to $1,500 in purchases per quarter in spending categories that change quarterly. Featured categories often include gas stations, grocery stores, restaurants and Amazon.com. Cardholders also earn 1% on all other purchases…and they can receive a $20 statement credit for each school year when they earn a GPA of 3.0 or higher. Journey offers 1% cash back on all purchases, but that jumps to 1.25% in months when the student pays his/her bill on time. The cards charge no foreign-transaction fees.