An offer to purchase can be canceled but it will be extremely costly.
When a buyer cancels an offer to purchase:
An offer to purchase is a legally binding document, therefore, you need to be absolutely certain that you can afford to home, and that you want the home.
The seller, similarly, can be sued, or forced to go ahead with the sale.
However, the offer to purchase may include clauses that allow for it to be cancelled under certain conditions. Suspensive conditions that need be fulfilled before the offer to purchase becomes valid can also be included, allowing for the offer to be cancelled if they are met in a certain amount of time.
It is always best to consult an attorney to help determine whether you can cancel the offer to purchase without legal consequences.