Class B office buildings are known for being old, no-frills and off the beaten path. What they are usually not associated with is energy efficiency.

That may be changing. In the last few years, a handful of those buildings in New York, in Hudson Square, the garment district and Times Square, have taken steps to shrink their carbon footprints, as their fancier Class A counterparts have done for years.

While landlords of Class B buildings find it difficult to recoup what they spend on green features from their tenants, energy savings can be significant, analysts say. And with mounting pressure from city officials on landlords to make their buildings more energy efficient — under the threat of possible punishment if they do not — similar properties are expected to do the same soon, analysts add.

“It took a long time for the market to shift, but it’s happening,” said Dana Schneider, an energy specialist and a senior vice president with the Jones Lang LaSalle commercial brokerage.