Fourteen people were also injured in the shooting spree that took place in a number of locations.
The suspected attacker was an employee at a lawnmower factory in Hesston where one incident happened, police said. He was later shot dead.
Photo: BBC
The four deaths occurred in the attack at the Excel Industries factory.
Factory employee Martin Espinoza described how the gunman, a colleague who he said usually had a calm demeanour, attempted to shoot him.
The gunman pointed his gun at Espinoza and pulled the trigger, but the weapon was empty. Espinoza then ran away as the gunman took out a second gun.
The gunman worked at the Excel Industries lawnmower firm, authorities said. Photo: AP
Another witness described scenes of panic.
"All I know is I'm seeing people running and so I'm assuming fire, and so I take a few steps and I hear pop, pop and I'm thinking just some paint cans or something going up, and more people running and all of a sudden, pop, pop, pop, pop, pop, pop, pop, pop, pop and I'm going, ahh, I start running too," said one man.