It’s best not to use a debit card at all, if you can help it.
Card readers grab data off a credit or debit card’s magnetic strip without your knowledge, with some pump skimming devices being capable of stealing debit card PINs as well. It’s a good idea to avoid paying with a debit card at the pump. Armed with your PIN and debit card data, thieves can clone the card and pull money out of your account at an ATM.
That’s one reason, generally, why security and fraud experts recommend paying with a credit card over a debit card: If you use a credit card, you’re not actually spending your money, and you’re protected by your issuer’s zero-liability policy. When your debit card transactions are approved, the money is taken out of your account then and there. If a fraudster took the funds, you then have to wait for their recovery and return, which could take days or weeks. Credit cards can also potentially earn you rewards on gas purchases, depending on which one you use.
Some newer pumps may include more mobile payment options like Apple Pay, Samsung Pay or Android Pay, which don’t require the customer to share credit or debit information with the station at all. If you use a mobile payment service that’s enabled at a gas station your frequent, opt for that payment method over your card. In general, newer pumps are going to be more secure for payments than older pumps.
Edit: BIG misunderstanding here. Both debit and credit cards in the US have chips which are more secure against skimming. However, many if not most gas pumps around the US have not been updated with the modern chip readers and therefore people who pay with a card at the dated pumps only have the option to slide their card through the reader. This makes both credit and debit cards susceptible to skimming. Credit cards are not immune from skimming. Credit cards are more protective against the effects of fraudulent charges on your account.