Swartz hanged himself in his Brooklyn, N.Y., apartment, said a statement released by his family and his girlfriend.
"Aaron's commitment to social justice was profound, and defined his life," the statement said. "He used his prodigious skills as a programmer and technologist not to enrich himself but to make the Internet and the world a fairer, better place."
On his blog, Swartz had written of his history of depression.
He was a Harvard University fellow studying ethics when he was charged in 2011 with stealing nearly 5 million articles from a computer archive at the Massachusetts Institute of Technology.
He faced 13 felony charges, including wire fraud, computer fraud and unlawfully obtaining information from a protected computer. Prosecutors said he intended to distribute the articles on file-sharing websites.
Swartz pleaded not guilty, and his trial in federal court was scheduled to begin next month. If convicted, he could have faced decades in prison and steep fines.
On Saturday, his family and girlfriend called his death "the product of a criminal justice system rife with intimidation and prosecutorial overreach" and blamed decisions by the Massachusetts U.S. attorney's office and MIT for contributing to his death.
Some legal experts believe the charges are unfounded since Swartz had been a university fellow, which gave him the right to access the articles.
In 2011, Carmen M. Ortiz, the U.S. attorney for Massachusetts, defended the charges, telling the New York Times: "Stealing is stealing, whether you use a computer command or a crowbar, and whether you take documents, data or dollars."
The Electronic Frontier Foundation, a San Francisco-based digital rights group, called him "an extraordinary hacker and activist."
"Aaron did more than almost anyone to make the Internet a thriving ecosystem for open knowledge, and to keep it that way," the foundation said in a tribute on its website.
On Saturday, American historian Rick Perlstein, who was a friend, called Swartz a philosopher as well as an activist. Swartz had also co-founded the political action group Demand Progress, which campaigns against Internet censorship.
"He had this feeling for data and what it could do, how to master it instead of letting it master us," Perlstein told The Times. "He just insisted on and struggled to live a life of maximal authenticity and integrity."
Born in 1986 in Chicago, Swartz created his first Web application — an online encyclopedia that operated much like Wikipedia — when he was 13.
High school bored him, he later said. After his freshman year, he studied at home and took community college classes that included logic and number theory.
At 14, he helped develop the software behind RSS feeds, which distribute content over the Internet.
He was soon working on such major projects as creating universal ways to exchange information through a group founded by Tim Berners-Lee, the computer scientist considered the father of the World Wide Web.
As a freshman at Stanford University, he studied sociology but left after a year because "I didn't find it a very intellectual atmosphere," he later said.
Swartz moved to Cambridge, where he began to work on a project that in 2005 turned into the social news website Reddit, which taps "the wisdom of the crowds" by letting users submit and rank news and other online content.
Conde Nast purchased Reddit the next year for a figure insiders put at less than $5 million, Forbes reported in November.
In a 2007 speech called "How to Get a Job Like Mine," given at a computer conference, Swartz gave such advice as "be curious," "say yes to everything" and "assume nobody else has any idea what they're doing either."
Swartz is survived by his parents, Robert and Susan Swartz; his younger brothers, Noah and Ben; and his partner, Taren Stinebrickner-Kauffman.
Times staff writer Jessica Guynn contributed to this report.Copyright © 2015, The Baltimore Sun