SAN FRANCISCO — Two days after Donald J. Trump won the 2016 election, executives at Google consoled their employees in an all-staff meeting broadcast around the world.
“There is a lot of fear within Google,” said Sundar Pichai, the company’s chief executive, according to a video of the meeting viewed by The New York Times. When asked by an employee if there was any silver lining to Mr. Trump’s election, the Google co-founder Sergey Brin said, “Boy, that’s a really tough one right now.” Ruth Porat, the finance chief, said Mr. Trump’s victory felt “like a ton of bricks dropped on my chest.” Then she instructed members of the audience to hug the person next to them.
Sixteen months later, Google’s parent company, Alphabet, has most likely saved billions of dollars in taxes on its overseas cash under a new tax law signed by Mr. Trump. Alphabet also stands to benefit from the Trump administration’s looser regulations for self-driving cars and delivery drones, as well as from proposed changes to the trade pact with Mexico and Canada that would limit Google’s liability for user content on its sites.
Once one of Mr. Trump’s most vocal opponents, Silicon Valley’s technology industry has increasingly found common ground with the White House. When Mr. Trump was elected, tech executives were largely up in arms over a leader who espoused policies on immigration and other issues that were antithetical to their companies’ values. Now, many of the industry’s executives are growing more comfortable with the president and how his economic agenda furthers their business interests, even as many of their employees continue to disagree with Mr. Trump on social issues.
The relationship remains bumpy. Mr. Trump lashed out at Amazon on Twitter on Thursday, accusing the e-commerce giant of evading taxes. (Amazon said it had saved $789 million under the tax law Mr. Trump signed.) The president is also expected to sign legislation, passed by the Senate last week, that would strengthen policing of sex trafficking online — a bill that internet companies once opposed because they worried it would make them liable for content posted by their users.
Yet quietly, the tech industry has warmed to the White House, especially as companies including Alphabet, Apple and Intel have benefited from the Trump administration’s policies.
Those include lowering corporate taxes, encouraging development of new wireless technology like 5G and, so far, ignoring calls to break up the tech giants. Mr. Trump’s tougher stance on China may also help ward off industry rivals, with the president squashing a hostile bid to acquire the chip maker Qualcomm this month. And Mr. Trump let die an Obama-era rule that required many tech start-ups to give some workers more overtime pay.
Mr. Trump “has been great for business and really, really good for tech,” said Gary Shapiro, who leads the Consumer Technology Association, the largest American tech trade group, with more than 2,200 members including Apple, Google, Amazon and Facebook.
Mr. Shapiro said that he had voted for Hillary Clinton, Mr. Trump’s opponent, in 2016, but that he and many tech executives had come around on Mr. Trump. While they disagree with him on immigration and the environment, they have found areas where their interests align, like deregulation and investment in internet infrastructure.
“This isn’t Hitler or Mussolini here,” Mr. Shapiro said. And even though the president’s new tariffs on steel and aluminum could hurt American businesses and consumers, “disagreement in one area does not mean we cannot work together in others,” Mr. Shapiro said. “Everyone who is married knows that.”
Mr. Trump himself has taken to naming tech companies he says are on his side.
After Apple took advantage of the new tax law in January to bring back most of the $252 billion cash hoard that it had parked overseas, the company said it would make a $350 billion “contribution to the U.S. economy” over the next five years. That prompted Mr. Trump to suggest he had made good on a campaign pledge to get Apple to bring jobs back to the United States.
“You know, for $350 million, you could build a beautiful plant. But for $350 billion, they’re going to build a lot of plants,” the president told members of Congress last month. Mr. Trump said he had called Timothy D. Cook, Apple’s chief executive, to personally thank him.
In fact, Apple has no plans to build a plant in the United States. The company is uneasy with Mr. Trump’s invoking it to signify how his policies are working, according to a person close to Apple who was not authorized to speak publicly. Apple has not, however, publicly corrected the president.
Mr. Trump has also stayed quiet on the controversy engulfing Facebook over user privacy, while other politicians have called for more regulations after revelations that the British political consulting firm Cambridge Analytica improperly harvested the information of 50 million Facebook users. Cambridge Analytica used that data to aid Mr. Trump’s campaign.
Michael Kratsios, the White House’s deputy chief technology officer, said in an interview that while Mr. Trump and Silicon Valley had their differences, “in places where we do see eye to eye, I think we’re achieving extraordinary success.”
Dean Garfield, head of the Information Technology Industry Council, a 102-year-old advocacy group that represents the biggest tech firms, said his members walked a tightrope, supporting and opposing the president on different issues. Lately, he said, “we have reached balance in the tightrope.”
The equilibrium marks a turnabout from what had been a testy relationship between Mr. Trump and the tech sector. On the campaign trail in 2016, Mr. Trump was so critical of tech companies that Jeff Bezos, Amazon’s chief executive, once joked he might send Mr. Trump to space in a rocket.
Some tech executives have since disagreed with Mr. Trump on social issues. Mr. Cook emailed staff last June to say he had unsuccessfully lobbied the president to remain in the Paris climate accords. In November, Microsoft sued the administration to protect a law that blocks deportation of young undocumented immigrants known as Dreamers. More than 100 companies, including Google, Facebook and Uber, filed a brief supporting California’s lawsuit on that issue.
Even so, tech executives worked to build a relationship with the president, with some meeting him at Trump Tower before his inauguration and again at the White House in June. While in Washington for the second meeting, Mr. Cook and Satya Nadella, Microsoft’s chief executive, also dined with Jared Kushner, the president’s senior adviser and son-in-law, and Ivanka Trump at the couple’s Washington home, according to a person briefed on the meeting who wasn’t authorized to speak publicly about it. This month, Treasury Secretary Steven Mnuchin visited Apple’s headquarters.
Silicon Valley has found plenty to like about the Trump presidency. In September, tech giants including Facebook and Microsoft teamed up with the administration to pledge $500 million to computer science education. Amazon, Microsoft and Google are also eyeing the administration as a potential customer as Mr. Trump pushes to modernize the government’s digital infrastructure.
But Silicon Valley’s favorite thing about Mr. Trump is almost certainly his new tax code. Many tech companies lobbied for corporate tax reform for years before Mr. Trump signed the new tax bill.
Tech giants immediately reaped the benefits. Under the new rules, Apple saved $43.7 billion in taxes, according to the Institute on Taxation and Economic Policy, a nonpartisan tax research group. Apple then announced the $350 billion “contribution” to the American economy over five years.
Most of the tally was previously planned spending with American suppliers and a $38 billion tax payment on its overseas cash. But Apple also said it planned to hire 20,000 new workers, invest in new data centers and another domestic campus, and increase a fund for innovative American manufacturers to $5 billion from $1 billion. It also gave employees $2,500 bonuses.
The president was quick to tweet the news.
The shifting relationship between Silicon Valley and Mr. Trump appears to have upset some tech employees. A Facebook page called “Angry Googler,” with nearly 1,000 followers, has been dedicated to criticizing Google for any sign it was cooperating with the president.
“Not happy about Google pulling a 180 and jumping into bed with Trump? Same here,” said the “About” section of the page, which suggests it is run by a Google employee. This month, the page posted an article about Google helping the Defense Department analyze drone footage. “We’ve gone from organizing the world’s information to … optimizing weapons of war,” the page said.
Messages to the account were not returned. Google declined to comment.
Some tech firms remain discomfited about appearing as the president’s allies. Last month, Rob Goldman, Facebook’s vice president of advertising, played down Russia’s impact on the 2016 election after the Justice Department charged 13 Russians with trying to subvert its outcome, including by using Facebook. Mr. Trump retweeted Mr. Goldman approvingly.
Facebook was uncomfortable with that association with the president, said a person close to the company who was not authorized to speak publicly.
Two days later, Facebook’s policy chief, Joel Kaplan, distanced the company from Mr. Goldman’s comments.
“The special counsel has issued its indictments, and nothing we found contradicts their conclusions,” he said in a statement. “Any suggestion otherwise is wrong.”