Todd Sherman, a product manager at the company, said he was in a meeting when the sound of people running through the building rumbled into the room.
As he headed toward the building’s exit with others, someone told him there was a shooter.
“At that point every new person I saw was a potential shooter,” he wrote on Twitter. “I looked down and saw blood drips on the floor and stairs.”
Police found one gunshot victim near the entrance of the building, San Bruno Police Chief Ed Barberini said.
Two injured women ran across the street and took shelter in a restaurant, officials said. A fourth person injured an ankle while fleeing but was not hurt by gunfire, officials said.
One of the injured women had a bullet wound in her leg. Michael Finney, a worker at a nearby Carl’s Jr. told reporters that he fashioned a bungee cord into a tourniquet and helped the woman until she was taken to a hospital.
A law enforcement official identified the shooter as Nasim Aghdam, a prolific user of YouTube. Aghdam’s father told a reporter for a CBS affiliate in Los Angeles that his daughter had been missing for several days. He said he had warned police that she was angry with YouTube.
Authorities did not identify the victims.
Zuckerberg San Francisco General Hospital spokesman Brent Andrew said a 36-year-old man was in critical condition, while two women were being treated for injuries. One of the women was in critical condition, while the other was in fair condition, a hospital official said.
YouTube’s parent company, Google, said it is cooperating with law enforcement.
Employees described a chaotic scene inside the corporate offices when the gunshots rang out. Some ran; others hid.
Many were initially stunned. Some reported hearing fire alarms. Others said they thought the loud bangs they heard came from people moving equipment.
Dianna Arnspiger told the Associated Press that the shooter wore glasses and a scarf and was using a “big, huge pistol.”
“It was a woman, and she was firing her gun. And I just said, ‘Shooter,’ and everybody started running,” Arnspiger said.
She hid in a conference room before leaving the building.
Vadim Lavrusik, who works on the company’s product team, tweeted after barricading himself in a room with co-workers in the moments after the shooting.
Software engineer Zach Vorhies said he left the building on his skateboard and heard a commotion in a building courtyard: Someone was shouting, “Come and get me!” Nearby, he saw a man lying on his back with a blood stain soaking through his shirt on his stomach.
“I didn’t understand what was going on until police came in the door,” he said. “And then I got out of there.”
Dozens of officers converged on the complex and conducted a room-to-room search for attackers. Many workers were escorted out of the building with their hands in the air, as police worked to secure the large office space, which houses more than a thousand YouTube workers in several buildings.
After the incident, President Trump praised the quick response: “Our thoughts and prayers are with everybody involved. Thank you to our phenomenal Law Enforcement Officers and First Responders that are currently on the scene.”
YouTube, San Bruno’s biggest employer, has been in the process of expanding its space in the office park for years.
Google CEO Sundar Pichai said in a statement that he was “grateful to everyone inside and outside the company for the outpouring of support and best wishes.”
“I know a lot of you are in shock right now,” he said. “Over the coming days, we will continue to provide support to help everyone in our Google family heal from this unimaginable tragedy.”
The heads of YouTube, Amazon.com, Twitter and Apple also spoke out online. (Jeffrey P. Bezos, founder of Amazon, owns The Washington Post.)
Most acts of mass violence are carried out by men, and female shooters are rare. An FBI report of shooter incidents nationwide between 2000 and 2013 examined 160 such attacks and found that just six involved female shooters.
The most well-known mass shooting in recent memory involving a female attacker occurred in 2015 in San Bernardino, Calif., about 430 miles southeast of YouTube’s offices. A husband and wife who had pledged allegiance to the Islamic State gunned down 14 people at an office holiday party before they fled and were killed by police.
Drew Harwell and Mark Berman contributed reporting.