The marks on the living room window frame gave it away. William Hart remembers seeing those scratches when he sat in his cubicle, gazing out the window as he tried to puzzle out a particularly thorny problem with the IRS’s acquisition software.

When he and his wife were shown the apartment, Hart examined the window. There was no doubt. The software developer’s new home would be where his cubicle once was. After spending 10 years working for the IRS in the Oxon Hill, Md., office building, Hart returned in June to live there with his wife.

“When I visited this apartment, I already knew that I used to work on the eighth floor,” Hart said. “To see this, it was like, wow, you worked right here in this very same apartment.”

In a city overrun with Type A workaholics who spend so much time in their offices that they might as well live there, turning cubicles into homes seems logical. But there are sound economic reasons, too.

Across the region, as law firms downsize and the federal government retrenches, the Washington area is awash in vacant offices.

Now, increasing numbers of those underused office buildings are being converted into residential dwellings in an effort to address a worsening housing shortage that is causing rents to rise and driving up home prices.

Since 2008, 7.9 million square feet of office space in the D.C. region has been converted or is being converted into residential dwellings, according to Jones Lang LaSalle (JLL), a commercial real estate brokerage. Fifty-three buildings have made the transition — 21 in the District, 21 in Northern Virginia and 11 in Maryland.

Take two former office buildings in Northeast Washington and McLean. Each one was 100 percent vacant when developers decided to turn them into apartment buildings, according to CoStar. Now, Anthology is 93 percent occupied and Haden Apartments is 97 percent occupied.

The Oxford, a 187-unit luxury apartment building where Hart lives, is one of the more recent office-to-residential conversions. Built in 1986, the building had been sitting vacant for three years when Bethesda-based Varsity Investment Group scooped it up in 2017. It began leasing in December and is 62 percent leased.

Compared with other metropolitan areas, the D.C. region lags in office-to-residential conversions. Philadelphia has been much more active, with 180 such projects in the past 20 years. That city has more industrial-type buildings that are prime for these types of conversions, and the city offers a 10-year tax abatement on renovations.

But local municipalities have so far resisted offering incentives to developers to convert underused buildings into affordable housing — which means the trend is unlikely to benefit low-income residents directly.

“It’s really costly,” said Paula Munger, assistant vice president of industry research and analysis at the National Apartment Association. “I’m not surprised all you see is luxury because those are the prices [developers] would have to charge to get through all of the issues with conversions.”

The D.C. Council created the Office-to-Affordable-Housing Task Force last year to see whether some of the city’s excess office space could be transformed into affordable housing. In a report prepared by the Coalition for Nonprofit Housing and Economic Development, the task force found that “there are some opportunities to convert vacant office space to affordable housing in the District,” but “office-to-residential conversions are not the most efficient way to address the city’s pressing housing needs.” The report recommended that the District offer subsidies, zoning incentives and feasibility studies to developers if it wanted to pursue office-to-affordable-housing conversions.

There are plenty of buildings waiting to be transformed. A recent search of CoStar’s database uncovered dozens of office buildings in the region with 0 percent occupancy. According to JLL, the District’s office vacancy rate in the second quarter of 2019 was 11.7 percent, Maryland’s was 17 percent and Virginia’s was 20.1 percent.

Converting vacant offices into livable spaces appears to make a lot of sense, but developers have been reluctant to tackle such conversions. It costs a lot of money to transform offices into homes. Rick Liu, an economic and development specialist at the Montgomery County Planning Department, suggested in a post on the department’s blog that there are cheaper ways of dealing with vacancies.

An owner can leave a building vacant in hopes of eventually attracting a large tenant or the federal government, subdivide it into smaller spaces, renovate it to make it more competitive or lower rents to attract more tenants.

Liu also pointed out that the architectural elements common in office buildings — deep floor plates, closely spaced structural columns and dedicated core spaces for elevators and utilities — make such conversions a challenge for developers.

And local governments aren’t providing financial incentives to make the conversions more viable for developers. The prevailing thought seems to be that local governments would rather ease the permitting and zoning process to undertake these projects than offer financial inducements. According to a 2017 Greater Greater Washington story, no office-to-residential conversion in the D.C. region has used financial incentives from a local government.

But even with tax incentives, other barriers exist to affordable housing.

“The tax incentive would be attractive, but you have to look at all those other factors that just may not be worth that effort,” Munger said.

In a study conducted this year, the National Apartment Association found that the D.C. region is the fourth-most-difficult metro area in which to build new apartments. The barriers to apartment construction include high construction costs, restricted land supply, infrastructure constraints driven by traffic and school crowding, and heavy affordable housing requirements.

The starkest cost-benefit analysis of office-to-residential construction came from a study done three years ago. The Montgomery County Planning Department contracted with Bolan Smart Associates to look at the potential reuse of office buildings in two markets — White Flint and Rock Spring. As part of the study, Bolan Smart compared the cost of updating a hypothetical existing office building, converting it to residential use, and demolishing the existing building and constructing a new residential building. They found it was much cheaper to update the office building, projecting a profit of $190,530. They projected a loss of $12.9 million for an office-to-residential conversion and a loss of $10.7 million to demolish the existing building and construct a new apartment building.

Even so, the lack of vacant, buildable lots, a waning demand for office space and a surging demand for housing are causing some developers to overcome their reticence. Escalating rents are making the numbers work more in their favor.

“Owners and developers in the D.C. metro looked to other property types, especially residential, largely because of the return on investment,” Nicholas Mills, an analyst at CoStar, wrote in an email. “In the office sector, rent growth peaked at about 2.5 percent in 2015, and has steadily slowed since then. Apartments, on the other hand, saw rents grow 3.5 percent in 2015, and while that growth rate slowed in the proceeding years, rent growth is back near 3.5 percent again. Driving these rent gains is the demand. Apartment demand has been near unlimited for luxury apartments over the past few years, whereas office demand has been lagging. And so it made sense for a lot of these developers to repurpose the land use to a more profitable and in-demand use case.”

The Oxford is Varsity Investment Group’s third office-to-residential conversion in the area. What sold them on the building was its location and view. The building is on Oxon Hill Road near National Harbor and adjacent to Rivertowne Commons shopping center. Nearby retail outlets include AMC Rivertowne 12, Home Depot and Safeway, with Target slated to arrive soon.

Because the 10-floor building is atop one of the region’s highest elevations — several companies rent space on the roof for their cell towers — it offers a panoramic view of the Washington area.

“The view sold us,” said Scott Shinskie, a partner at Varsity.

One of the biggest hurdles facing project architect Soto Architecture and Design was bringing natural light into the living spaces. The solution for bedrooms with no outside windows was clerestory windows along the tops of the walls and frosted doors.

Not every apartment at the Oxford suffers from lack of sunlight. Hart’s three-bedroom unit on the eighth floor has abundant natural light and spectacular views.

“I have that view from basically every room in my apartment,” he said. “If you keep the bathroom door open, you can get that view from the bathroom when you are brushing your teeth.”

Many newly built apartment buildings come with standard floor plans that resemble boxy hotel rooms. Not the Oxford. Because the architect wanted to maximize the natural light in each unit, there are 39 floor plans, most of which have unusual shapes with odd angles. According to Shinskie, it took both high- and low-tech tools — everything from virtual-reality goggles to blue painter’s tape on the floors — to design the floor plans.

“It’s got some weird angles in the other units,” Hart said. “Our unit, not so much, with the exception of the master bedroom, but it’s large enough to overcome the strange angles.”

Property manager Shaheer Williams said many renters are drawn to the unique shapes of the floor plans.

The building does have some things going for it — 12-foot-high ceilings, concrete floors that muffle sounds and extra-wide stairwells and hallways.

“That was a selling point also, the concrete construction,” Hart said. “Because I worked there, I knew you couldn’t hear through the floors. And then a bonus, I think, was the high ceiling.”

Although the exterior still resembles the 1980s office building it once was, the interior has been completely transformed. The Oxford has all the amenities one would expect in a luxury building — a spacious 24-hour fitness center, a 24-hour business center, package storage lockers and lounges with WiFi, fireplaces and big-screen televisions. The 10th-floor lounge has the best views in the building, a pool table, shuffleboard and a kitchenette. There’s the ubiquitous dog-washing station and a fenced-in courtyard for pets to roam.

Rents range from $1,580 to $3,018 a month.

Shinskie said it cost about as much to renovate the building as it would have to build a new one. But the new building wouldn’t have had the features that set this one apart — the concrete floors, the high ceilings and the wide stairwells and hallways. That type of building would have been too expensive to construct.

“You wouldn’t build this from the ground up,” he said.

Asked whether his company would consider doing another project like the Oxford, Shinskie said it would.

“We’re actually looking for opportunities,” he said. “This was fun.”