Reference price systems for prescription drugs constitute widely adopted cost containment tools. Under these regimes, patients co-pay a fraction of the difference between a drug's pharmacy retail price and a reference price that is set by the government. Reference prices are either externally (based on drug prices in other countries) or internally (based on domestic drug prices) determined. We study the effects of a change from external to internal reference pricing in Denmark in 2005. We find that the reform led to substantial reductions in retail prices, reference prices and patient co-payments as well as to sizable decreases in overall producer revenues and health care expenditures. The reform induced consumers to substitute away from branded drugs for which we estimate strong preferences. The increase in consumer welfare due to the reform therefore depends on whether or not we take perceived quality differences into account in its calculation.