"We have one subject who is deceased inside the building with a self-inflicted wound," San Bruno Police Chief Ed Barberini told reporters.
"At this time, we believe it to be the shooter."
Barberini mentioned "four victims" but it was not immediately clear if that included the shooter.
There was no immediate word on any motive.
Shootings by women are an extremely rare occurrence in the United States where the overwhelming majority of gun violence is carried out by men.
According to an FBI study that looked at 160 incidents involving one or more shooters in public places between 2000 and 2013 -- just six of the people who opened fire were women, a share of 3.8 per cent.
Amid conflicting reports on casualties, Barberini said the injured "have been transported and are being treated for injuries that are treatable."
He said police had sealed off the building as they pursued the investigation and searched for any additional possible victims.
Frantic escape
Employees recounted frantic scenes as they fled YouTube’s headquarters near San Francisco, with one saying he saw blood on the floor as he escaped.
"We were sitting in a meeting and then we heard people running because it was rumbling the floor. First thought was earthquake," employee Todd Sherman tweeted.
Sherman said that as he headed for an exit "someone said that there was a person with a gun," and added "at that point every new person I saw was a potential shooter."
Sherman’s tweets continued: "I looked down and saw blood drips on the floor and stairs. Peeked around for threats and then we headed downstairs and out the front."
One image posted by a Twitter user showed employees being led out of the building with their hands up, with no further explanation.
Another YouTube employee, Vadim Lavrusik, tweeted: "Active shooter at YouTube HQ. Heard shots and saw people running while at my desk. Now barricaded inside a room with coworkers."
Later, Lavrusik said he had escaped to safety.
Witnesses reported helicopters on the scene as well as police SWAT teams.
The White House said President Donald Trump had been briefed and that his administration was monitoring the ongoing situation in San Bruno.
Shortly afterward, Trump tweeted, "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 headquarters is located some 50km from the main Google campus in Mountain View.
The shooting, which follows a series of deadly gun incidents at schools and elsewhere, comes amid heated debate on gun control measures in the United States.
An estimated 1.5 million people participated in demonstrations March 24 calling for stricter firearms measures following a deadly shooting in Parkland, Florida.
Organisers of the March for Our Lives sent a message of solidarity to the employees hit by Tuesday’s shooting, tweeting "Our hearts are with you, @YouTube."
Source from Vietnamnews.