A man armed with a shotgun and two handguns opened fire in a classroom at an Illinois university on Thursday -- killing five students and wounding 16 others before turning the gun on himself.

Northern Illinois University President John Peters said the gunman fatally shot four women and a man in a "brief, rapid-fire assault."

Of the six total dead, four died at the scene, and the other two died in hospital.

Northern Illinois University Police Chief Donald Grady said the man, who was not a student at the school in Dekalb, was dressed in black. He has not yet been publicly identified.

Peters said the man was a former graduate student in sociology at NIU. But he said he wasn't currently enrolled there.

Police said they do not yet have a motive for the shooting.

The were more than 100 students in the classroom at the time of the shooting at the 25,000-student campus, located about 100 kilometres west of Chicago.

Students described running for their lives under a hail of bullets, saying the shooter seemed to have already decided on specific targets, and went for one particular section of the lecture hall.

"It was almost like he knew who he wanted to shoot," student Edward Robinson told reporters. "He knew who and where he wanted to be firing at."

Another student, George Gaynor, told the school newspaper that the shooter was "a skinny white guy with a stocking cap on."

He described the ensuing scene as like a war zone where terrified students were diving for cover.

"Some girl got hit in the eye, a guy got hit in the leg," Gaynor said, minutes after the shooting occurred. "It was like five minutes before class ended, too."

Victims were taken to nearby Kishwaukee Community Hospital. Spokesperson Theresa Komitas confirmed that 17 victims had been admitted with wounds from the shooting or flying debris.

One victim died, two were admitted and three were discharged. Five were being evaluated and six others in critical condition were transferred to other hospitals. At least one male died at OSF St. Anthony Medical Center in Rockford, an official told the Associated Press.

First year student Jillian Martinez told the Chicago Tribune she was in the auditorium when the gunman entered through a door to the right of the podium and opened fire at about 3 p.m.

"He just started shooting at all the kids," she said. "He just started shooting at people, and I ran out of there as fast as I could. I ran all the way to the student center; when I got there I could still hear shooting (from the classroom).

Classes were cancelled following the attack and the campus was to remain closed on Friday. Students were to be offered counselling in campus residences and were urged to call their parents to alert them of their safety.

The U.S. Bureau of Alcohol, Tobacco, Firearms and Explosives was assisting local authorities at the scene, spokesperson Thomas Ahern told the Chicago Tribune, saying the agency would be tracking the guns to determine their ownership and history.

Northern Illinois University had been closed briefly in December following the discovery of racial slurs and references to the earlier Virginia Tech school shootings written on one of the dormitory's bathroom walls.

Police at that time determined there was no immediate threat.

The shooting was the fourth within a week in the United States.

On Feb. 8, a woman killed two fellow students before shooting herself at Louisiana Technical College in Baton Rouge. In Memphis, Tenn., a 17-year-old was accused of shooting and critically wounding another high school student Monday during a gym class, and the 15-year-old victim of a shooting at an Oxnard, Calif., junior high school has been declared brain dead.

With files from the Associated Press