NEW YORK — Big U.S. banks have been reporting billions of dollars in paper losses this month as they are forced to come into compliance with the new tax law. And while the losses are massive, they were largely expected, and bank executives say the new tax law will be good for banks as well as the economy in the long run.

The biggest loser so far has been Citigroup, which reported Tuesday an $18 billion loss largely because of the tax law. The actual write-downs were even larger than that, more than $22 billion just in the quarter. It was one of the largest quarterly losses in Citi’s history.

The charges that these banks are taking fall into two categories.

The lion’s share is tied to what’s known as deferred tax assets. During the financial crisis nearly a decade ago, banks racked up billions of dollars in losses from soured mortgages and other toxic assets. These losses, under U.S. tax law, can be converted into credits to be used to lower company tax bills in the future.

Citigroup, JPMorgan and other banks had assigned a value to these assets when the top U.S. corporate income tax rate was 35 percent. But when the Trump tax law lowered the top rate to 21 percent this year, the value of those deferred tax assets had to be adjusted.

Citi’s exposure to these deferred tax assets is abnormally large – more than $45 billion before Tuesday’s write-down – and is a byproduct of what happened to the bank during the financial crisis. Citi was the nation’s largest bank at the time, holding billions of dollars in mortgages and other complicated assets, and when the financial crisis hit, Citi came dangerously close to failing.

In comparison to Citi, the other banks’ deferred tax assets seem small. JPMorgan Chase reported a $2.4 billion paper loss tied into these assets. Goldman Sachs and Bank of America are also expected to announce single-digit billion-dollar losses when they report their results Wednesday. The smallest of the six major U.S. banks, Morgan Stanley, which reports its results Thursday, is expected to book a $1.3 billion charge for its deferred tax assets.

The other component of the banks’ write-downs this week is the repatriation of foreign earnings. Just like Apple, which has billions of dollars of its profits sitting in overseas subsidiaries, some of the major Wall Street banks also have foreign subsidiaries where they have been holding profits abroad in hopes of getting a better tax rate on those earnings.

The Trump tax bill provided exactly that. The new law is giving a one-time break to companies with “accumulated foreign profits” by taxing those earnings at just 15.5 percent.

Most major U.S. banks do the vast majority of their business at home and don’t have material amounts of foreign profits that they need to bring back, with the exception of two: Citigroup and Goldman Sachs. Both banks have large international businesses. Citigroup in particular has substantial banking businesses in Latin America and Asia.

When the tax law was enacted, Goldman estimated that it would have to take a $5 billion charge in the latest quarter, two-thirds of which related to repatriated foreign earnings, the rest to deferred tax assets. Citi said Tuesday that it was booking a $3 billion charge related to its foreign earnings.

Despite the short-term pain, banks expect the tax law to be ultimately good for them. Most U.S. banks had tax rates of around 30 percent, sometimes higher, and now are expecting effective tax rates of roughly 20 percent.

Most banks are expected to pass at least a portion of their new profits along to shareholders in the form of stock buybacks and higher dividends. It is still too early to see how much will go to consumers and businesses, although a few banks have announced wage increases for their lowest-paid employees as a result of the tax law.