Testing within that window adds the remaining time to the new certificate. You can test earlier, but the next renewal date will usually be based on the new test date.
Example
If the current MOT expires on 20 October, the earliest date that normally preserves the renewal date is 21 September.
Why book early?
An early test gives you time to compare repair options before expiry. Remember that a failed early test is recorded immediately. Whether you can continue driving depends on the remaining certificate, the defect classification and roadworthiness.
New vehicles
For a vehicle needing its first MOT, GOV.UK provides a different timing rule based on the registration anniversary. Northern Ireland has separate arrangements, so use the relevant official service.
Official source
Use GOV.UK MOT timing guidance and confirm the expiry date through the official MOT status service.