You can sell your home at any time after you buy it. You only pay a fee to your lender if your mortgage has a pre-payment penalty.
You should review your mortgage note and loan documents to determine if your loan has a pre-payment penalty. Most mortgages do not have a pre-payment penalty but some do.
Your mortgage note would outline the terms of any pre-payment penalty including the cost and when you are required to pay the penalty. In some cases, a pre-payment penalty is prorated depending on how long the mortgage is outstanding.
I should reiterate, however, that mortgage pre-payment penalties are relatively uncommon. Additionally, I have not heard of being required to pay a fine to your lender for paying off your mortgage early.
The other potentially significant costs involved in selling your home soon after you bought it are real estate agent commissions and closing costs.
When you sell a home, you are typically required to pay the commission for both the seller’s and the buyer’s real estate agent. Commissions vary based on many factors and are negotiable but usually total approximately 5% of the property purchase price. Plus, you are also typically required to pay other closing costs including the property transfer tax and escrow fees.
The commissions and closing costs are deducted from the property purchase price so if you are unable to sell your home for more than you bought it, you may lose all or part of your down payment. For example, if you bought the home for $100,000 and sell it for the same price but pay $6,500 in commissions and other closing costs, you end up losing that money, which means you do not recoup your full down payment.
Hopefully your home has increased in value, even over a short period of time, so you do not lose any money when you sell it.