If homeownership is your American dream, here is a wake-up call. It could take more than six years to save up for a down payment. High rents and high home prices have hit affordability where it hurts, lengthening the amount of time most potential buyers will need to even think about financing a home.

For the average renter buying the median-priced home in America, it will take about 6½ years to save for a 20 percent mortgage down payment, according to analysis by HotPads, a rental listing company operated by Zillow Group. In some places it can take more than two or three decades to save that much, the analysis says.

If the median U.S. home value, according to HotPads, is $216,000, then 20 percent is $43,200. If a renter making the median income were to save 20 percent of that income each month, it would take 77 months to get that down payment.

“The current generation of first-time buyers is dealing with unprecedented levels of student debt, making the down payment a major factor keeping young renters out of the housing market even though many young people say they have ambitions to buy,” wrote Joshua Clark, an economist at HotPads. “While some high earners may manage to save more than the recommended 20 percent of their income, or may have the good fortune of windfalls such as family assistance, inheritance, or large bonuses, most young adults struggle to save.”

Rents have been rising at a fast clip for several years. The typical renter spends 34 percent of his or her income on rent, which is more than the 30 percent some financial experts recommend.

Mortgage lenders usually require that a borrower pay no more than 43 percent of income on total debt in order to qualify for a loan, a provision of new government lending rules implemented after the financial crisis. That debt would include mortgage payments, in addition to things like student loan debt, auto and credit card debt.

All real estate is, of course, local, and so it will take potential buyers longer in some markets to save for a down payment.

Renters in 13 of the nation’s 35 largest markets may need more than a decade. In very expensive markets, like San Jose, California, Los Angeles and San Diego, it could take more than two and even three decades. In cheaper markets, like Pittsburgh, Cleveland and Detroit, it might take around four years, because these renters spend less of their incomes on rent.

There are other options than putting 20 percent down, however. First-time buyers often turn to FHA loans, which are government insured. They have a minimum down payment of 3.5 percent, although they also require mortgage insurance payments. For veterans and their families, down payments can be as low as zero. Fannie Mae and Freddie Mac also have fixed-rate mortgage programs requiring just a 3 percent down payment, but they also require mortgage insurance, adding to the monthly payment.