JPMorgan Chase reached a massive $13 billion settlement with the Justice Department on Tuesday over the sale of troubled mortgage securities. The settlement is the largest that the agency has ever reached with a single company.

Here is how the money will be spent:

1.) $4 billion to help struggling homeowners

- $2 billion to lower the principal balance of homeowners who owe more than their homes are worth

- $2 billion will go to an array of other types of homeowner relief, including lowering borrowers’ mortgage rates; donating distressed properties to nonprofits; issuing mortgages to low-and-moderate income families harmed by the financial crisis

2.) $9 billion to settle civil claims by various entities related to troubled mortgage-backed securities:

- $2 billion is a civil penalty to be paid to the Justice Department

- $1.4 billion for the National Credit Union Administration

- $515.4 million for the Federal Deposit Insurance Corp.

- $4 billion for the Federal Housing Finance Agency

- $298.9 million for the California attorney general

- $19.7 million for the Delaware AG

- $100 million for the Illinois AG

- $34.4 million for the Massachusetts AG

- $613.8 million for the New York AG

Source: The Justice Department; New York AG