But the court's decision does not undermine limits on individual contributions to candidates for president or Congress, now $2,600 an election.
Chief Justice John Roberts announced the decision, which split the court's liberal and conservative justices. Roberts said the aggregate limits do not act to prevent corruption, the rationale the court has upheld as justifying contribution limits.
The overall limits "intrude without justification on a citizen's ability to exercise 'the most fundamental First Amendment activities,'" Roberts said, quoting from the court's seminal 1976 campaign finance ruling in Buckley v. Valeo.
Justice Clarence Thomas agreed with the outcome of the case, but wrote separately to say that he would have gone further and wiped away all contribution limits.
Justice Stephen Breyer, writing for the liberal dissenters, said that the court's conservatives had "eviscerated our nation's campaign finance laws" through Wednesday's ruling and 2010 decision in Citizens United that lifted limits on independent spending by corporations and labor unions.
"If the court in Citizens United opened a door, today's decision we fear will open a floodgate," Breyer said in comments from the bench. "It understates the importance of protecting the political integrity of our governmental institution. It creates, we think, a loophole that will allow a single individual to contribute millions of dollars to a political party or to a candidate's campaign."
Congress enacted the limits in the wake of Watergate-era abuses to discourage big contributors from trying to buy votes with their donations and to restore public confidence in the campaign finance system.
But in a series of rulings in recent years, the Roberts court has struck down provisions of federal law aimed at limiting the influence of big donors as unconstitutional curbs on free speech rights.
Most notably, in 2010, the court divided 5 to 4 in the Citizens United case to free corporations and labor unions to spend as much as they wish on campaign advocacy, as long as it is independent of candidates and their campaigns. That decision did not affect contribution limits to individual candidates, political parties and political action committees.
Republican activist Shaun McCutcheon of Hoover, Ala., the national Republican party and Senate GOP leader Mitch McConnell of Kentucky challenged the overall limits on what contributors may give in a two-year federal election cycle. The total is $123,200, including a separate $48,600 cap on contributions to candidates, for 2013 and 2014.
Limits on individual contributions, currently $2,600 per election to candidates for Congress, are not at issue.
Relaxed campaign finance rules have reduced the influence of political parties, McConnell and the GOP argued.
McCutcheon gave the symbolically significant $1,776 to 15 candidates for Congress and wanted to give the same amount to 12 others. But doing so would have put him in violation of the cap.
Nearly 650 donors contributed the maximum amount to candidates, PACs and parties in the last election cycle, according to the Center for Responsive Politics.
The court did not heed warnings from Solicitor General Donald Verrilli Jr. and advocates of campaign finance limits that donors would be able to funnel large amounts of money to a favored candidate in the absence of the overall limit.