If you need to break your lease by moving out of a rental early, notify your landlord as soon as possible. The more notice you give, the better your chances are that your landlord will find a new tenant (and not end up using your whole security deposit or sue you in small claims court for rent for the remaining lease term).
Try to work out a written agreement with your landlord that cancels the lease and allows you to leave early. You might need to sweeten the deal: Offering to pay the landlord a certain amount (such as a half months' rent) in exchange for allowing you to break the lease often works. For example, if you want to leave three months before the end of your lease, you might offer to pay half a month’s extra rent if the landlord will sign an agreement releasing you from further responsibility under your lease.
If you're successful in getting your landlord's agreement to cancel your lease, get it in writing! Below is a sample agreement you can give to your landlord to sign. Edit it as needed (by adding, for example, the correct address, dates, payment amounts, and any other agreement) to cover your particular situation
Be sure to attach a copy of your current, fully signed lease. Once both you and your landlord have signed, keep a copy for your records. You'll want to keep a copy until your state's statute of limitations (the length of time someone has to sue after an alleged wrong occurs) for your landlord to sue you has run out—in some states, this can be as long as six years. If you have any question about how long to keep records about your rental, check your state's law or consult with a local landlord-tenant attorney.