Manufacturers publish cut sheets with drawings showing gap of tank to wall and base to wall. This should help you choose.
I've encountered this:
Are you measuring to a baseboard tile or trim? On many toilets, the tank lid is the closest to the wall, with the base of the toilet a few inches away. This may help you choose.