Getting into Stanford University can feel like winning the lottery.
In 2018, 47,451 students applied for a spot in the Stanford class of 2022. Less than 5% — 2,027 — were accepted.
Stanford is, itself, the story of a strong investment. Californian railroad tycoon and former governor Leland Stanford, and his wife, Jane Lathrop Stanford, founded the school in 1885 "to teach both the traditional liberal arts and the technology and engineering that were already changing America."
President Herbert Hoover was a member of the Stanford "Pioneer Class" of 1895, the first class to graduate after four full years at the school. In the 1920s he invested heavily in Stanford, founding what is today the Hoover Institution and Stanford's Graduate School of Business.
Since then, the school has become known for a strong athletic program that has produced several Olympians, scientific research that continues to produce results and entrepreneurial graduates who continue to give back to the university.
Located in Stanford, California, near Silicon Valley, the school has deep ties to the tech industry. William Hewlett and David Packard graduated with degrees in electrical engineering from Stanford in 1935 and turned their research into the company today known as HP in 1939. In 2001, the Hewlett Foundation donated $400 million to Stanford. At the time it was the largest single gift to an American college or university.
In 1994, Jerry Yang and David Filo co-created what would become Yahoo! while studying at Stanford. In 2007, Yang and his wife Akiko Yamazaki, also a Stanford alum, pledged $75 million to the university.
Sergey Brin and Larry Page met in 1995 and co-founded Google in 1998 based on a search algorithm they developed while studying at Stanford. Over the years, Google has donated millions to the university and according to ProPublica, Stanford has made "hundreds of millions of dollars selling Google stock that it received as payment for allowing Google to use technology developed at Stanford."
Mike Krieger and Kevin Systrom, co-founders of Instagram; Reed Hastings, co-founder, chairman and CEO of Netflix; and Reid Hoffman, co-founder and executive chairman of LinkedIn, are all among Stanford's successful alumni with connections to the tech industry.
And tech industry Stanford alums don't just give back to the university — they also hire Stanford graduates.
Approximately 51% of Stanford students choose to major in a science, technology, engineering or mathematics (STEM) field, and 22% study engineering specifically. Among the Stanford class of 2017, 69% stayed in California after graduation and 19% worked in the computer and IT industry. The biggest employers of this cohort include tech companies like Apple, Facebook and Google.
These deep connections to Silicon Valley and the tech industry helps create a cycle that allows Stanford to produce high-earning alumni, re-invest in students and grow its endowment. Today, Stanford's endowment is worth $26.5 billion, making it the fifth biggest college endowment in the U.S., according to the Department of Education.
The school is able to use its funds on a relatively small student body. In the fall of 2018, Stanford enrolled 7,083 undergraduate students and financial aid accounted for just 5% of Stanford's expenditures during the 2018-2019 school year.
Stanford rose to the top of CNBC Make It's ranking in large part because the university provides substantial financial assistance to low- and middle-class students. (You can read our full methodology here.)
According to Stanford's student budget breakdown for the 2019-2020 academic year, full tuition is $52,857 per year, while room and board is $16,433 per year. The school also estimates that students can expect to spend about $1,905 on student fees, about $1,245 on books and supplies and about $2,130 on personal expenses.
Even without considering travel expenses, that's an estimated total cost of about $74,570 a year. Over four years, a Stanford education could cost almost $300,000, but many students do not end up paying nearly this much thanks to scholarships and aid.
According to Stanford, the average scholarship and grant total for students from families making less than $65,000 a year is $74,095 per year. Students from families making between $65,000 and $95,000 receive $65,050 on average in scholarships and grant aid. And according to The Hechinger Report, the net cost for a student from a family that earns between $48,001 and $75,000 is $4,061 per year.
The school reports that 18% of students graduate with debt and that the median cumulative student debt total for undergraduate Stanford students who borrowed was $13,000 during the 2016-2017 school year.
"Stanford does not expect students to borrow to meet their need," E.J. Miranda, senior director of media relations at Stanford, tells CNBC Make It. "Two-thirds of Stanford undergraduates receive financial aid, about half receive need-based scholarship support from Stanford and more than 80% graduate with no student debt."
Public and private colleges were considered separately for our ranking. However, even when compared to the No. 1 public college on the list, University of Washington-Seattle, Stanford emerges as the clear best value for students from the designated income bracket.
The average net cost of University of Washington-Seattle for an in-state student from a family that makes between $48,001 and $75,000 is $8,984, and the median salary for alumni with 10 or more years of experience is $111,800. It's a terrific pay-off for graduates, but not enough to outshine Stanford, where the median salary of experienced alumni is $143,100.
For out-of-state students, the net cost for students to attend the University of Washington-Seattle is significantly higher. Even when considering only the lower in-state costs of University of Washington-Seattle, Stanford still reported a lower ratio of net costs to alumni earnings.
Stanford also beat out other prestigious schools, including Ivy League institutions Princeton, Harvard and Yale, as well as STEM-focused schools like the University of Chicago, CalTech and MIT.
All of these schools can provide a huge return on investment for students but this year, Stanford stands as the smartest investment around.
Like this story? Subscribe to CNBC Make It on YouTube!