When you cancel a credit card, especially if you are cancelling in favor of a new credit card, you are changing your credit history. Any change in your credit history can cause your credit score to drop, because cancelling represents some type of risk.
However it is not usually the cancelling of the credit card that causes your credit score to drop. It is usually the other actions that are associated with the cancellation that affect your credit.
Most people cancel a card by transferring its balance over to another credit card. When they do so, they might now have a higher balance on a credit card, meaning that their percentage of borrowed money vs. the percentage of money available is now higher, and this can cause your credit score to drop.
Similarly, some people open a new credit card and transfer the balance in that way. When you open up a new credit card, you get an inquiry on your account which gives your account a red mark. All inquiries into new credit affect your credit score, so your score will drop a little for that reason. Even though you have replaced one credit card with another, and you may even have a better interest rate on the new card, any change in your credit history is going to cause a blip on the radar.
Is There A Way to Reduce the Effect on My Credit Score?
The best way to not have cancelled credit cards affect your credit score is to not open up new credit cards that you don't plan on keeping - this includes cards associated with retail stores. Opening up a new credit card because you get a 15% discount is a quick and easy way to have terrible credit despite not missing a single payment or having any outstanding balances. It's not worth it.
But if you already have the card and wish to cancel it, the first thing you can do is pay off the balance. Cancelling an empty card is far less likely to have any effect on your credit.
If you cannot afford to pay back the card, try to pay back as much as you can and lower the balance to an amount that you think you can pay in 3 months. Then, when you transfer the balance over, pay it back over the course of 90 days. This shows credit companies that you are getting a new card for the purpose of getting a new card and not because you have any credit risks they do not know about.
Finally, if you have to transfer a balance over to other cards, try to transfer it to a card with a lower balance. It is better to have two cards at 35% of their balance filled than one card at 70% and the other at 0. You still want to pay back the outstanding balance as quickly as possible, but at least the hit you take on your credit will be much less.