One YouTube employee said he had just returned from lunch when shots were fired at the company's San Bruno, California, headquarters.
The employee, who did not give his name, told NBC Bay Area he ran into a closet and hid, still clutching part of his muffin. He stayed in the closet for around 10 minutes, and then he heard the fire alarm go off and "a woman yelling like she was mad."
At that point, he said, he and other nearby employees started running en masse toward the building's exits.
Senior software engineer Zach Vorhies, 37, said he was at his desk working on the second floor of one of the buildings on the campus when the fire alarm went off.
He got on his skateboard and approached a courtyard, where he saw the shooter and heard them yelling, "'Come at me, or come get me.'"
He said he saw somebody lying nearby on his back with a red stain on his stomach that appeared to be from a bullet wound.
He said he realized it was an active shooter incident when a police officer with an assault rifle came through a security door. He said he jumped on his skateboard and got out of the way.
Authorities said a woman believed to be the shooter died of a self-inflicted gunshot after wounding four people.
Dianna Arnspiger said she was on the second floor when she heard gunshots, ran to the window and saw a woman firing a gun on a patio below.
Arnspiger said she called out, "'Shooter,' and everybody started running." She and others hid in a conference room for an hour while someone called 911 repeatedly for updates. She said it was "terrifying."
Google employee Ricardo Luis Horna, 29, said he was on campus in a nearby building and saw his colleagues running from the building at 901 Cherry Ave.
"My colleagues got my attention. I ran outside to the parking lot. I ran into my car with my manager and drove off," he said.
Horna described "chaos" in the parking lot, where employees scrambled into vehicles and drove away from the campus. Horna said he drove to a restaurant "about 10 minutes away."
Janice Antonio works in a Kaiser Health facility near the YouTube campus. She said she heard sirens approaching and wondered if there was a fire.
But "then more sirens came, and I thought that was weird," Antonio told NBC News. "So the next thing you know...we're on lockdown."
Another witness, who gave his name only as Jesse, told NBC Bay Area he was getting a hamburger at a nearby Carl's Jr. restaurant and heard gunshots.
"I knew the shooter was right by me, because you could feel the sensations of the bullet," he said.
Jesse said he and other diners rushed to the aid of a victim who had been shot in the leg. They helped drag her inside the restaurant and tried to help stop the bleeding, he said.
Will Hudson said a friend who works for YouTube texted him about the shooter.
"I think there might be a shooter in my building," read one text. "The fire alarm went off so we started to evacuate and then people (started) running saying there was a shooter."
Hudson said the friend made it safely back to San Francisco and was in contact with his family. Hudson said he's become used to hearing about gun violence but has never been so close to it before.
"It just feels strange. It feels like it could really be anyone. That's really the strangeness of it," he said.
Television news footage showed people leaving the building in a line, holding their arms in the air for police to inspect as they went by. Officers patted down people grouped outside, and police vehicles surrounded the area.