By law, Social Security does not contribute to the federal debt.
The federal debt is a compilation of all annual deficits minus all annual surpluses. Consequently, Social Security does not add to the federal debt or deficit. Federal law makes this unambiguously clear:
Pub. L. 101-508, Nov. 5, 1990, 104 Stat. 1388-623
SEC. 13301. OFF-BUDGET STATUS OF OASDI [Social Security] TRUST FUNDS.
(a) [2 U.S.C. 632 note] Exclusion of Social Security from All Budgets.—
Notwithstanding any other provision of law, the receipts and disbursements of the Federal Old-Age and Survivors Insurance Trust Fund and the Federal Disability Insurance Trust Fund shall not be counted as new budget authority, outlays, receipts, or deficit or surplus for purposes of—
(1) the budget of the United States Government as submitted by the President,
(2) the congressional budget, or
(3) the Balanced Budget and Emergency Deficit Control Act of 1985.
Social Security Works’ fact sheet on Social Security and the debt ceiling explains in greater detail why Social Security does not contribute to the federal debt: