Compound interest is indifferent to which direction it runs. On debt, the interest you don't pay gets added to the balance, and next month's interest is charged on the larger amount. At credit-card rates — often 20% or more annually — this compounds fast enough that minimum payments can keep you in debt for decades on a balance you could otherwise clear in a couple of years.
This produces a clean rule: paying off high-interest debt is a guaranteed, risk-free return equal to the interest rate. Clearing a 22% credit card is mathematically equivalent to earning a guaranteed 22% on an investment — better than any realistic market return, with zero risk. This is why the standard sequencing is: clear high-interest debt before investing anything beyond an employer match. The exception is low-rate debt (a cheap mortgage), where investing may reasonably win.
The US Credit CARD Act of 2009 forced issuers to print something that had never appeared on statements before: a box showing exactly how long it would take to clear the balance making only minimum payments, and the total cost. The disclosure was added precisely because the arithmetic was invisible to consumers. A typical illustration on such statements shows a $5,000 balance at around 18% taking well over a decade to clear on minimums, with total interest often exceeding the original balance. Research on the disclosure found it nudged some borrowers to pay more than the minimum, though critics noted the anchor cut both ways — showing a minimum payment at all makes it a salient reference point. The deeper lesson is that the minimum payment is engineered to keep the compounding running in the lender's favor for as long as possible.