Most lenses typically increase in sharpness from wide open to around f8/10 thereafter that point they typically reduce in sharpness as diffraction kicks in. As a result typically if you want the sharpest then around f8 is going to give you that result. However each lens will have its own sweet spot, you can test for this and read reviews to find out the ideal perfect aperture for sharpness
However remember that this is only looking at "the best" sharpness possible and isn't taking into account usability and personal requirements. Wide open chances are you can get very usable images, just as you can get them at f13 and even f16 - so you should never get into your mind that you should only shoot at f8 for perfect sharpness.
Another point is that with a zoom lens you'll typically see its sharpness degrade at the longer end of its zoom range so for a zoom lens you will see a difference not just with the aperture, but also with the focal length used (typically this will be something you notice at the extremes of the aperture range - at f8 you might not see much difference from 70m to 200mm - at f2.8 chances are you will)