There are a couple of different answers to this question, and there are multiple timelines and time travel trips involved, so don't expect too much precision here. That said, they're somewhere between 8 and 10 years old.
The Season 4 episode "Act Your Age" features an introduction from the creators, Dan Povenmire and Jeff Marsh, who state that the episode takes place 10 years in the future. The story is about Phineas and Ferb getting ready to go to college. That means that it's most likely that they're 18 or 19 years old at the time, assuming they received a (relatively) normal American education. So, that would make them 8 or 9 years old in the show's regular timeline.
That being said, the Season 2 episode "Phineas and Ferb's Quantum Boogaloo" sees them travel forward in time 20 years and upon arrival in this timeline they're said to be 30 years old. That makes them 10 years old in the regular timeline.
This discrepancy could easily be explained if they didn't take the standard educational route. If they're 10 years old, then in "Act Your Age's" future scenario they're going to college at 20, which isn't all that abnormal — it's pretty easy to picture Phineas and Ferb taking a gap year.
Of course, that requires us to assume that they remain 10 years old throughout the course of the show. That's pretty standard for cartoons, which don't have to explain their actors visibly aging (Bart Simpson, for example, has been in elementary school since 1989), but it does pose a problem if we're already putting this much work into figuring out their ages. If we assume they're aging in real time, then they're both 25 years old when they start college in "Act Your Age."
Have a question? Email us at questions@tvtabloid.com. Please include your name and town. Personal replies will not be provided.