Hundreds of thousands of Chinese students are flocking to U.S. colleges and universities, helping to drive the number of international students studying in the country to record levels.

Similarly, all-time high numbers of American students are studying abroad, although there are far fewer and they tend to do much shorter stints than students coming to the United States.

The findings were in an analysis released Monday that was conducted by a nonprofit group working with the State Department.

They say international education programs do more than advance cultural enrichment; they also are an economic boon to communities that host foreign students and to the students themselves, who improve their job competitiveness.

Foreign students contribute about $24 billion annually to the U.S. economy, and about two-thirds of them primarily pay their own way or their families do, according to the Institute of International Education and the State Department’s Bureau of Educational and Cultural Affairs.

All told, 819,644 students came to the United States to study abroad in the 2012-13 school year. The highest numbers were from China, India, South Korea, Saudi Arabia and Canada. That’s a record high, with a 7 percent increase from a year earlier and 40 percent from more than a decade ago. Despite the increases, international students make up less than 4 percent of all students.

There was some slowdown in the number of students coming to the United States in the years after the Sept. 11 attacks, in part because of visa issues, but the number has since rebounded.

About 235,000 of the international students were from China, a 21 percent increase. A burgeoning middle class combined with a view that America has quality colleges and universities were factors cited as driving the demand. About one-third studied business and management once they arrived, the report said.

“Chinese students and their parents are looking for high quality education, get the importance of international education, and it’s making America the No. 1 destination because we actually have the capacity to absorb international students,” said Allan Goodman, president and CEO of the institute.

The number of students from Saudi Arabia studying in the United States jumped 30 percent, to 45,000. These students are largely funded by a Saudi government scholarship program nearly in its 10th year, the report said.

The top destinations for international students were the University of Southern California in Los Angeles; the University of Illinois Urbana-Champaign in Champaign, Ill.; Purdue University in West Lafayette, Ind.; and New York University and Columbia University in New York.

By contrast, 283,332 U.S. students studied abroad for academic credit — a 3 percent increase from a year earlier.

In the past 20 years, the number of U.S. students studying abroad has tripled. But less than 10 percent of American students study abroad during their college years. The United Kingdom, Italy, Spain, France and China were the top destinations.

Attention tied to the Beijing Olympics and more classes taught in English are factors starting to drive more American students to China, Goodman said. A State Department program called 100,000 Strong, which officially started in 2010, aims to send 100,000 American students to China over a four-year period.

The report found that 14,887 Americans studied in China in 2011-2012 — a 2 percent increase, but that doesn’t include students going to China for noncredit programs.

“We encourage study abroad whether it’s short term, long term; whether it’s credit, noncredit,” State Department official Evan Ryan said.