The beloved Magnolia Bakery — made popular by HBO’s “Sex and the City” series — is moving its main offices to 244-250 W. 54th St. between Broadway and Eighth Avenue.

The new 4,800-square-foot space on the fifth floor had an asking rent of $64 per square foot.

The decade-long deal was completed directly with David Zar of Zar Property NY, which owns the Midtown Manhattan building.

Magnolia’s offices are now located slightly north of Columbus Circle at 1841 Broadway, which is slated to be demolished for a new apartment tower being developed by Global Holdings.

Three other tenants from that building — Coliseum Dental, Motion PT Group and Beam Laser Spa — have also cut deals to relocate into the Zar property. Rents there run from the $50s to high $60s per square foot. The 145,170-square-foot loft office building was purchased by Zar for in 2017 for $83.1 million.