After two years of determined budget-cutting in state capitals, five states have raised their income or sales taxes since last month and more than 20 others are considering major tax increases this year, a legislative group said yesterday.

Any such widespread state tax hikes could have some depressing effect on consumer spending, which many economists had hoped would lead the nation out of the long recession.

While the federal government can run up large deficits to stimulate the economy in recessionary times, most state governments are legally required to balance their budgets and have had to dig deeper into taxpayers' pockets to stay in the black.

These efforts also represent an abrupt end to the "Proposition 13" era of tax-cutting initatives that swept the states in recent years. California, which started the trend by slashing taxes in 1978, now faces a deficit that may be as large as $1.8 billion.

The new figures are contained in a survey by the National Conference of State Legislatures, which pronounced the fiscal condition of the states "exceedingly grim."

Projected tax revenues are down in every state except Alaska, Montana and Massachusetts, the survey found.

Nineteen states are facing budget deficits when their fiscal year ends in June, and 12 others have a slim surplus of less than 1 percent of their annual budgets.

Two-thirds of the states already have cut the budgets they had adopted for this year, and many have cut to the bone.

For example, 28 states have cut the size of their work force through layoffs or attrition, 21 have adopted a hiring freeze and 17 have reduced or eliminated cost-of-living or other raises for state employes. Others, such as Idaho, have placed employes on shorter work weeks or mandatory furloughs.

Conference President William Passannante, speaker pro tem of the New York Assembly, said the states "face a no-win situation: raising taxes or additional cutbacks in government spending and services."

The latest data are even bleaker than an earlier report by the National Governors' Association, which found that anticipated revenues for 41 states dropped nearly $8 billion in the last six months.

Until 1982, most states concentrated on paring the budget and raised only minor taxes such as those on alcohol, tobacco and gasoline. In the first half of last year, however, nine states raised their politically sensitive taxes on income or sales. And in special legislative sessions that began in December, New Jersey, Minnesota, Indiana, Nebraska and Mississippi raised their income tax, and all but Nebraska raised their sales tax as well.

These states took different approaches: New Jersey boosted the income tax only for people earning more than $50,000 a year, Mississippi raised it for those making more than $10,000 and Minnesota nearly doubled a special surcharge on income taxes.

There are growing indications that "1983 will see more increases of major state taxes than any year in more than a decade," the study said. This will not increase the size of state government, however, but simply will recoup some of the revenue that states gave away by cutting taxes in recent years.

The fiscal strains have reached every part of the country, including the southern and western states. Idaho is facing a deficit equal to 16.1 percent of its budget, for example, while shortfalls amount to 13.8 percent in Michigan and 11.8 percent in Arizona. Louisiana, one of several states hurt by depressed oil prices, has a 3.5 percent shortfall, as does Virginia.

The healthiest states are Wyoming, which has an 11 percent surplus, and Alaska, with an 8.8 percent surplus.

Some states have avoided year-end deficits only through severe cutbacks. Minnesota cut spending by 16.2 percent last year, Indiana by 11.8 percent, Nevada by 11.1 percent, West Virginia by 8.9 percent and Alabama by 7.9 percent.

Budgeting gimmicks also have become popular. Seventeen states got a one-time windfall last year by speeding up tax collections, with Missouri withholding taxes from business every week instead of every month. Eighteen states, including Indiana, have postponed certain expenses until the next fiscal year.