Credit cards are almost always safer than debit cards as they provide a layer of protection between your bank balance and a potentially malicious actor or badly designed web portal that overcharges you. Assuming your payment information is stolen this what ends up happening for both:
Credit Card:
1. You notice an anomalous payment or your credit card provider does.
2. You contact them or they contact you, the card is closed and the payments are invested and temporarily reversed removing them from your monthly bill.
3. A new card is issued to you which you typically receive within 3 days.
4. If a charge is found to be legitimate it is passed back onto you and you might get in trouble for fraud.
As credit cards are paid once per month during this time no money is moved out of your bank account and it is instead applied against your credit limit, which you should pay off fully each month to avoid interest.
Debit Card:
1. You notice an anomalous payment or your bank does.
2. You contact them or they contact you, the card is closed and the payments are invested.
3. A new card is issued to you which you typically receive within 3 days.
4. If a charge is found to be illegitimate the money is put back into your account. This can take several weeks.
5. If the payment or payments exceeded your balance you will be charged overdraft fees.
So let's walk through a hypothetical situation with Bill who has $1,000 in the bank, a credit card with a limit of $1,000 and a debit card. What's happen when it gets stolen when he gets a pizza worth $5 for each.
Credit Card:
1. Pizza is purchased, ($995)
2. Card information is stolen by a skimmer
3. Thief uses card to pay for a $5 pizza to verify the information is valid ($990)
4. Thief attempts to buy ten $100 iTunes gift cards. This exceeds the available limit so he instead gets 9 of them ($95)
5. The thief manages to get away with it somehow but this triggers the credit card company to look at the transaction, freeze the account and contact the owner.
6. The card is cancelled, a new card is sent out and the credit card company works with law enforcement to verify that it was theft and to catch the thieves.
6a. The obvious charges are removed from the associated account restoring the amount of available credit to $990 (within a day or so)
7. The less obvious $5 charge is also removed (within a week or so). If this resulted in paying too much on the previous bill the amount that was overpaid is credited to the account.
Debit Card:
1. Pizza is purchased, ($995)
2. Card information is stolen by a skimmer
3. Thief uses card to pay for a $5 pizza to verify the information is valid ($990)
4. Thief attempts to buy ten $100 iTunes gift cards. This causes an overdraft with all of the associated fees and penalties ($-10)
5. When attempting to check his account Bill finds out he has no money in it and calls the bank in a panic.
6. The card is cancelled, a new card is sent out and the bank works with law enforcement to verify that it was theft and to catch the thieves.
7. The charges that can be shown as fraudulent are cancelled and money is put back into the account. Some banks will forgive overdraft fees, while others tend not to. (within a week or two)