The Internet genius behind the popular Web site Reddit.com committed suicide at his Brooklyn home today, police sources and friends said.

Cops discovered Aaron Swartz unconscious at 9:30 a.m. and are now investigating whether he hanged himself, law enforcement sources said.

Swartz helped create Reddit and drafted an early version of the RSS format, a “Web feed” that syndicates popular headlines.

MIT PRESIDENT EXPRESSES REGRETS OVER SUICIDE OF REDDIT CO-FOUNDER

Friends yesterday called him a prolific intellectual — and a computer geek legend — who had long suffered from depression.

“We have lost someone today who had more work to do — and who made the world a better place,” his pal Cory Doctorow wrote on the blog Biong Boing.

Swartz was also an avid Internet activist, who pushed to make web files open to the public. He opposed the “Stop Online Piracy Act,” which keeps hackers from swiping web content such as music and movies.

But that mindset got him into trouble in June 2012, when federal officers arrested him for allegedly downloading academic journals on the subscription-only website JSTOR.com.

He pleaded not guilty to fraud in 2012 — but the case remained open at the time of his death. He faced decades in prison and a fortune in fines.

That may have added to his depression, according to a woman who claimed to be his mother on a hacker news forum yesterday.

“Aaron has been depressed about his case/upcoming trial, but we had no idea what he was going through was this painful,” she wrote.

She added, “Aaron was a terrific young man.”

Swartz began computer programming as teen — then went on to be a something of a hacker idol, friends said.

“Aaron’s mind was a wonderful thing to get to encounter,” friend Alyssa Rosenberg wrote on the blog thinkprogress.org.

But even his astounding achievements seemed bleak in his own tortured mind.

He described his depression in a 2007 entry on his blog “Raw Thought.”

He wrote, “You feel worthless.You wonder whether it’s worth going on. Everything you think about seems bleak — the things you’ve done, the things you hope to do, the people around you.

Swartz, who lived in an upscale building in Crown Heights, also founded the policy-based website Demandprogress.com, a forum for web-based activism.

This past May, Swartz delivered the keynote address at a conference in Washington, which you can watch below.

— Additional reporting by Dana Sauchelli