All but 1.5 per cent of the enlisted men in the Federal Army were between 18 ... The average age was slightly under 26 years (25.8083) at time of enlistment
I'm going to say 25.8, Yes, That's my final answer.
The average Union soldier was 25.8 years old; there is no definite information on the average age of Confederate soldiers, but by the end of the war old men and young boys, who otherwise would have stayed home, were being pressed into service. The average soldier on both sides was a white, native-born, protestant farmer.
According to these guys, 25.8 years old, but I'd love to see their methodology of calculating that (eg. is that a really true weighted average throughout the war, is it age at joining the army, mustering out, etc.?) To calculate the true average age, you'd need some pretty interesting algorithms, a good database of every single person in the army with things like when they enlisted, how long they were in, when they were out (either by death or not) and crank all that data