The pandemic made Americans richer across every racial, ethnic and income group—though not equally.

Home values shot up, and with fewer opportunities to spend money during lockdowns, many people paid down debt and boosted savings. Between 2019 and 2021, the median household’s net worth increased 30% to $166,900, according to a report out Monday from Pew Research Center.

The wealth of white and Asian households increased the most in total dollars during those years. For many Black and Hispanic families, the boost wasn’t enough to lift them fully out of debt. One in four Black households and one in seven Hispanic households had zero wealth at the end of 2021, though they did manage to make a dent in their debt.

These families are likely under greater strain now that many of the factors that boosted wealth during the pandemic have reversed.

Higher inflation, combined with the end of government stimulus checks and a resurgence of consumer spending, might have chipped away at Americans’ net worth, said Rakesh Kochhar, a senior researcher at Pew Research Center who co-wrote the report. After-tax income fell nearly 9% in 2022 after stimulus payments stopped. Mortgage rates are also the highest they have been in two decades.

“More recent trends suggest that the rate of increase in household wealth is probably not something that sustained itself through 2022,” said Kochhar.

Racial wealth gaps

Asian households held the most wealth overall, the report found. Their net worth grew 43% to $320,900 in 2021. White households posted a 23% increase to $250,400.

Hispanic households had a net worth of $48,700 and Black households held $27,100 by the end of 2021.

Wealth gaps were widest among lower-income households, who are less likely to own homes and have assets in retirement accounts, the report found. Low-income white households had 21 times the wealth of low-income Black households. Among middle- and upper-income families, the ratio is three to one.

The least wealthy Black households cut debt from a median of $10,100 to $4,000 by the end of 2021. The median net worth for low-income Hispanic households rose to zero, from $1,100 in debt. The least wealthy white and Asian households ended the pandemic with net assets of $4,700 and $8,900, respectively, according to the report.

At the wealthier end of the spectrum, the median net worth of those earning more than $171,600 a year was $1.1 million for Asian households and $923,300 for white households. Upper-income Black and Hispanic households had net worths of $285,000 and $350,000, respectively. The report didn’t include the richest 1% of households.

For most American households, a home is their primary asset, with 62% living in homes they owned in 2021. The homeownership rate was highest among white households, followed by Asian, Hispanic and Black households. Homeownership accounted for about two-thirds of the median household’s net worth.

Asian households, meanwhile, were the most likely to have investments and retirement accounts.

How Americans are trying to build wealth

People who have been able to sustain the wealth they gained during the pandemic either already had good financial habits before it started or developed those habits during it, said Nick Holeman, director of financial planning at Betterment, a financial advisory firm.

When the pandemic hit, Duncan Moore, 27 years old, was making $18 an hour as a restaurant manager. The restaurant closed temporarily and Moore, who now lives in Denver, started receiving $1,700 stimulus checks every two weeks.

“It was a pretty significant jump in my income,” he said.

He paid off thousands of dollars in credit-card debt, got his laptop fixed and started an emergency-savings fund.

Moore purchased two houses with his business partner, which they flipped and resold together. He was able to boost his savings to $15,000, Moore said. They have since bought more homes and plan to rent them out.

“My life is significantly better than it was before,” Moore said.

Write to Oyin Adedoyin at oyin.adedoyin@wsj.com