The shooting took place when the students were being dismissed at Marjory Stoneman Douglas High School in the city of Parkland in Broward County, just north of Miami on the state's southeastern tip.
The suspected gunman, captured shortly after the shooting, was identified as Nikolas Cruz, a 19-year-old expelled student at the school. An AR-15 semi-automatic rifle was found at the site.
Broward County Sheriff Scott Israel told reporters that 12 of the victims were killed in the school building, two were killed outside, and one shot fatally on a road nearby. Two more died in the hospital.
All of the victims have been identified, Israel said, but no identities will be made public until the families of all of those affected have been notified.
At least 14 others were wounded, five of whom had life-threatening injuries, hospital authorities said.
"I was on the first floor of the building where the shots happened first," freshman Jason Snytte told US television network NBC News.
"I heard six or seven shots. Our door was open. I ran and closed it, and everybody ran into a corner," he said.
Federal and local authorities said there was no indication that the gunman had any accomplice.
"This is a terrible day for Broward County, the state of Florida, the United States," Israel said. "There really are no words."
Cruz, the shooter, was sent to a local hospital for "labored breathing" and was later released to police for custody, local authorities said. He is due in court Thursday.
Police said Cruz carried "countless" magazines, and pulled the fire alarm after entering the school, causing the students to crowd into the hallway where he stood ready to shoot.
Cruz then tried to leave the scene with a group of evacuating students, but was unsuccessful in the attempt.
Police did not identify the motive of the crime, but people who knew Cruz said the youth had a troubling past. Police said that "disturbing" content was found after going through Cruz's Internet activities.
"You come to the conclusion this is just absolutely pure evil," Florida Governor Rick Scott said Wednesday night.
The shooting is among the 10 deadliest mass shootings in modern US history.
"My prayers and condolences to the families of the victims of the terrible Florida shooting. No child, teacher or anyone else should ever feel unsafe in an American school," tweeted US President Donald Trump, who was briefed on the incident and was monitoring the situation, according to White House Press Secretary Sarah Huckabee Sanders.
Senator Jeanne Shaheen from New Hampshire said "We cannot allow this to continue to be the status quo. Congress has a responsibility to take action and help keep guns out of the wrong hands."
Senator Bernie Sanders of Vermont said "Maybe, just maybe, after 18 school shootings in America in just 43 days of 2018 the Congress might want to consider common-sense gun safety legislation and save innocent lives."
The incident took place as Parkland, with a population of 31,000 in 2016, has recently been listed by a national survey as one of the safest cities in Florida.