This distance is determined by your local plumbing code. There is no limit to the length of the toilet's trap arm if you're in the IPC. That's right, there is no limitation. You can have an unlimited distance for your fixture drain.
Let's Get It Fixed!
HomeX virtual experts will assess your issue (for free!) and can resolve simple problems.