The rights activists include Yara Sallam and Sanaa Seif, described by Amnesty International as "prisoners of conscience." Seif has been on hunger strike for about two months, her mother Laila Soueif said.
The Cairo court also ordered each of the 23 defendants to pay a fine of 10,000 Egyptian pounds (about $1,390).
Some of the activists had supported the military's overthrow of Islamist president Mohamed Morsi in July last year which unleashed a deadly crackdown on his Islamist supporters.
They had since turned on the new authorities as it extended a crackdown on all protests.
The verdict, one of several against secular-leaning activists in recent months, may be appealed.
The defendants were accused of holding an illegal protest on June 21 calling for the release of detainees and the annulment of a law that bans all but police-sanctioned demonstrations.
They were also accused of vandalism during the demonstration near the presidential palace in Cairo.
"The ruling is political, it has no legal grounding," alleged Ahmed Ezzat, one of the defence lawyers, after judge Abdelrahman al-Zawary pronounced his verdict.
The defendants were present inside a caged and soundproofed dock when the judge read out the verdict to a stunned courtroom.
Signup to our newsletter and follow us on Facebook and Twitter!
The crackdown on secular and left leaning protesters has sparked accusations that President Abdel Fattah al-Sisi, the former general who toppled Morsi, is unwilling to tolerate any dissent.
Sisi and his supporters say the troubled country needs a firm hand to get back on its feet after almost four years of turmoil following the 2011 overthrow of veteran strongman Hosni Mubarak.
Some of the youth leaders who spearheaded the anti-Mubarak uprising and were once hailed as national heroes have been jailed under the law restricting protests, enacted in November last year following Morsi's overthrow.
"The general trend is to target the youths," said Leila Soueif after the verdict. Her son Alaa, a prominent leftist activist, is also facing a separate trial on similar charges.
Washington, which helps bankroll Egypt's army and has come to terms with the overthrow of democratically-elected Morsi, had demanded Egypt release the "secular" activists during a visit by US Secretary of State John Kerry in September.
The United States and other countries have also called on Egypt to free three journalists with the English language Al-Jazeera broadcaster who have been sentenced to up to 10 years for allegedly defaming Egypt.