Microsoft began laying off about 6,000 workers Tuesday, nearly 3% of its entire workforce and its largest job cuts in more than two years as the company spends heavily on artificial intelligence.

Hard hit was the tech giant's home state of Washington, where Microsoft informed state officials it was cutting 1,985 workers tied to its Redmond headquarters, many of them in software engineering and product management roles.

Microsoft said the layoffs will be across all levels, teams and geographies but the cuts will focus on reducing the number of managers. Notices to employees began going out on Tuesday.

The mass layoffs come just weeks after Microsoft reported strong sales and profits that beat Wall Street expectations for the January-March quarter, which investors took as a dose of relief during a turbulent time for the tech sector and U.S. economy.

“I think many people have this conception of layoffs as something that struggling companies have to do to save themselves, which is one reason for layoffs but it’s not the only reason,” said Daniel Zhao, lead economist at workplace reviews site Glassdoor. “Big tech companies have trimmed their workforces as they rearrange their strategies and pull back from the more aggressive hiring that they did during the early post-pandemic years.”

Microsoft employed 228,000 full-time workers as of last June, the last time it reported its annual headcount. About 55% of those workers were in the U.S.

Microsoft announced a smaller round of performance-based layoffs in January. But the 3% cuts will be Microsoft's biggest since early 2023, when the company cut 10,000 workers, almost 5% of its workforce, joining other tech companies that were scaling back their pandemic-era expansions.

Microsoft's chief financial officer, Amy Hood, said on an April earnings call that the company was focused on “building high-performing teams and increasing our agility by reducing layers with fewer managers.” She also said the headcount in March was 2% higher than a year earlier, and down slightly compared to the end of last year.

The layoffs are hitting all parts of Microsoft's business, including the video game platform Xbox and the career networking site LinkedIn. Some laid-off workers and the executives who made the cuts took to LinkedIn to talk about them.

“This is the first time I’ve had to lay people off to support business goals that aren’t my own," wrote Scott Hanselman, a vice president of Microsoft's developer community. “I often have trouble separating my beliefs with the system that I participate in and am complicit in. These are people with dreams and rent and I love them and I want them to be OK.”

He added: "This is a day with a lot of tears.”

The company didn't give a specific reason for the layoffs, only that they were part of "organizational changes necessary to best position the company for success in a dynamic marketplace.”

Microsoft has said it has been spending $80 billion in the fiscal year that ends in June on building data centers and other infrastructure it needs to develop its artificial intelligence technology, though it has also scaled back some of those projects. Those AI tools have been pitched as changing the way people work, including in Microsoft's own workplaces.

Microsoft CEO Satya Nadella told Meta CEO Mark Zuckerberg at an AI event last month at Meta's headquarters that “maybe 20, 30% of the code” for some of Microsoft's coding projects “are probably all written by software.”

Even if AI is increasingly helping Microsoft software engineers, however, doesn't necessarily mean it's a chief reason for laying them off.

“When these big tech companies say that they’re trimming management layers, that doesn’t really sound like it’s being driven by AI,” Zhao said. “You’re not expecting ChatGPT to replace the manager.”

Instead, cutting management ranks can often reflect a broader strategy.

“As companies grow quickly, you need to add managers who can coordinate across teams or within teams,” Zhao said. “But it’s not until things start to slow down that people start asking questions about how necessary those roles are.”

Of the laid-off employees in Washington, about 1,500 worked in person at Microsoft's offices and 475 worked remotely, according to the notice the company sent to the state employment agency. Their official last day will be in July.

After hiring sprees that started when the COVID-19 pandemic spiked demand for online services, many tech companies are still in a process of “coming back to Earth and trying to kind of rebalance some things,” said Cory Stahle, an economist at Indeed, the job listings website.

And while Microsoft isn't as directly affected by President Donald Trump's wide-ranging tariffs as some of its peers, it must also think more broadly about economic conditions that could play out over the coming months and years.

“This could be an effort to think more long term,” Stahle said. “If you have to go out and buy groceries and spend more on groceries and produce that are more expensive due to tariffs, you maybe don’t have as much discretionary income to spend on electronics or video game systems.”