Another body was found at an address in Hoboken, New Jersey, which is linked to the gunman. It is understood it may be his father.
The rampage in the northeastern state was the fourth big shooting spree in five months in the United States.
It was by far the deadliest of the year and most heart-wrenching. The children were among the youngest victims of a mass shooting in recent history. Frightened students who were rushed from the building by police were told to close their eyes.
"Our hearts are broken today," President Barack Obama said, wiping his eyes during brief comments to reporters in one of the most emotional public moments of his presidency.
The children killed were just five to 10 years old, he said. "They had their entire lives ahead of them -- birthdays, graduations, wedding, kids of their own."
The attack at Sandy Hook Elementary School, just two weeks before Christmas, was America's second-deadliest school shooting, exceeded only by the Virginia Tech university massacre in 2007 that left 32 dead.
Photos from the scene showed students, some of them crying, being escorted by adults through a car park in a line, hands on each other's shoulders.
Children told their parents they had heard bangs and, at one point, a scream over the intercom. Teachers ordered them to hide in cupboards or corners.
State police said 18 children were found dead at the school and two later were declared dead, and six adults were found dead at the scene.
It has been reported two people were found dead at other scenes, leading to a total death toll of 28. A law enforcement official said the suspect Adam Lanza was killed by a self-inflicted gunshot wound, and he was the son of a teacher at the school.
Adam Lanza's older brother, 24-year-old Ryan, of Hoboken, New Jersey, was being questioned.
The law enforcement official, who said Adam Lanza had a possible personality disorder, said Ryan Lanza had been extremely co-operative, was not believed to have any involvement in the rampage.
Ryan Lanza told law enforcement he had not been in touch with his brother since about 2010.
The gunman drove to the school in his mother's car, the second official said. Three guns were found -- a Glock and a Sig Sauer, both pistols, inside the school, and a .223-caliber rifle in the back of the car.
The official also said Lanza's girlfriend and another friend were missing in New Jersey.
Anguished parents came running to the school to search for their children. Robert Licata said his six-year-old son was in class when the gunman burst in and shot the teacher.
"That's when my son grabbed a bunch of his friends and ran out the door," he said. "He was very brave. He waited for his friends." Licata said the masked guman didn't say a word.
Stephen Delgiadice said his eight-year-old daughter heard two big bangs, and teachers told her to get in a corner. His daughter was fine.
"It's alarming, especially in Newtown, Connecticut, which we always thought was the safest place in America," he said.