The 5 years can include time before citizenship and even before the green card. The only restriction is that 2 years must be after your 14th birthday, and all the 5 years must have been before the birth.
However, be aware that they can be very nitpicking when it comes to proof of the 5 years. They often discount or disregard a lot of evidence*, so many people who actually had the 5 years were unable to secure US citizenship for their children who were born abroad. If you only have 8 years, that might not be enough to get them to accept 5 years.
*for example, they may disregard employment evidence such as paystubs if the type of job is such that significant amounts of work could have been done outside the US. If you're a bus driver for a particular city you obviously have to be in the US to drive the bus, but if you're a programmer or manager or accountant you could be doing your job from anywhere. And if you submitted university transcripts but didn't attend summer school, they'll count only 8 or 9 months per year because you could have been outside the US for the summers.