Cole Sprouse, also known as Ben from Friends, graduates with twin brother Dylan

Cole Sprouse, who played Ben on Friends, has graduated from university alongside his twin brother Dylan. The former child stars shared photos on Twitter and Instagram of their big day, surprising fans who couldn't quite believe how much time had passed.

Dylan and Cole, who also starred in The Suite Life of Zack & Cody, graduated from the Gallatin School of Individualized Study – a small college that is a part of New York University.

The 22-year-old brothers both received honours and were given the privilege of wearing gold tasselled-caps at Wednesday's ceremony.

Smarter better faster stronger. Finished NYU now on to the next

A photo posted by Dylan Thomas Von Sprouse (@dylan_spr) on

The former child stars, who featured in The Suite Life of Zack & Cody, both graduated with honours

Dylan is believed to have completed a video game design course while Cole majored in archaeology.

Cole posted various snaps on Twitter of the hilarious duo posing in their purple gowns and pulling excited faces at the camera. "We just graduated! Dylan bit me right after the last pic. #NYU," wrote the actor alongside his photo collage.

Cole also took a moment to reflect on his past four years at university, writing: "We've tried to do right, to fix some of the negative stereotypes of child stardom. We've had some bumps, but I'm so glad we went to Uni."

cole-sprouse-twitter-VIEW GALLERY

Cole Sprouse, 22, studied archaeology while Dylan took up video game design

His brother Dylan followed suit, posting a photo on Instagram and captioning it: "Smarter better faster stronger. Finished NYU now on to the next."

The twins landed their first major role in Big Daddy, acting as seven-year-old boy Julian opposite Adam Sandler. Their career had started long before however, as Cole and Dylan appeared in advertisements from as young as eight-months-old.

cole-sprouse1-VIEW GALLERY

Cole played David Schwimmer's son Ben in Friends

At the age of nine, Cole went on to play Ben from Friends – a role his brother did not share – and acted alongside David Schwimmer, Jennifer Aniston and Courteney Cox among other stars.

Dylan and Cole's second biggest claim to fame was playing brothers in The Suite Life of Zack & Cody – the Disney series they starred in for three years.