Multinational corporations increasingly use royalty payments for intellectual property rights to shift profits globally. This not only threatens the tax base of countries worldwide but also affects the nature of tax competition. Against this background, our theoretical analysis suggests a surprising solution to the problem of curbing profit shifting without suffering major outflows of capital: a strictly positive withholding tax on royalty payments is both the Pareto-efficient solution under international coordination and the optimal unilateral response. If internal debt is sufficiently responsive, governments can even implement optimal targeting. Then, the royalty tax closes the profit-shifting channel, while all competition for mobile capital is relegated to internal-debt regulation. Our results question the ban on royalty taxes in double tax treaties and the EU Interest and Royalty Directive.