On the Gintama official page, it says Gintoki's age is 20+. But it is not clear how old he is, because in the last generation of the Joui war, the foursome of Sakata Gintoki, Katsura Kotarou, Takasugi Shinsuke, and Sakamoto Tatsuma joined. So it's confusing what his real age is.
It seems that Gintoki is about 25 to 26 years old.
In the Ask Sorachi segment of
Episode 9: “You should go all out in a fight” Gin were described as a "hairless baby" when the Amanto first arrived. Shortly after which the Joui war started.
[After credits and preview]
Class: Teach us, Ginpachi sensei!
Gintoki: Um, this is a question from a Mr. Oonishi, from the second floor. ‘I noticed something strange the other day. Shinpachi-kun said that the “purge” was a movement that happened twenty years ago to drive amanto off earth. So, no matter how you cut it, Gin-san and Katsura-san have to be more than thirty years old. Is that true?’ Uh, ok now. Pay attention now, cuz this is gonna be on the test. The war of expulsion didn’t end in just a year or two, you see. When the war started twenty years ago, Gin-san was still just a hairless baby. The shogunate, afraid of the aliens, surrendered right away, but the samurai still resisted. It was around this time that Gin-san got a different kind of hair. When the amanto had infiltrated the entire government and were running roughshod over the whole nation, Gin-san finally entered the fight! Well, in a manner of speaking…So, that’s how the war of expulsion, lasting ten full years, happened. Gin-san and his friends only really participated in the very end of it. Oh, and Oonishi, go stand in the hall! Source: wikiquote
Gin was said to join the war towards the end, at which point we know he must be at least 20 years old. As that is how long the war just about lasted. But this was already known, as this was also answered inside the sorachi segments (see image)
Now using this live journal as a guide line we can see that up to episode 195 roughly 4 years have passed based on the seasons represented, and Christmas specials. As there are now 281 episodes, and it roughly takes 49 episodes to progress a year another 1.8 years should have about passed making Gintoki 25, almost 26
I think he's around 23-24. On episode 292, when gintoki wore a 3rd year uniform he said that he's a 9th year, this implies that he's about 23-24 since a 3rd year is usually 17-18.
And on Ginpachi sensei, it was said that 20 years ago, gintoki was this hairless baby, who doesn't look to be more than 4 years old, also when he went to join at the very end of the war that lasted for ten years, this was when he started growing a different kind of hair which is usual on 10-15 year old boys. He's likely around that age when he joined the war.
Between 24-28. We know he is younger than Kondo who is 28 and we know he should be older than Mutsu who is revealed to be 24 in her episodes. I like to think he is the same age as Hijikata (who he has many parallels with) so around 27 (the same should be the case with Takasugi and Katsura who were his classmates and Sakamoto who may be a year older at most)