Pinion gear interchangeable?

I know it’s okay to switch between 10 and teeth but could you possibly switch to an eight tooth pinion gear if my starter was originally at 10 as long as it matches up to the flywheel, of course.