Firstly, this depends whether you are in a fixed term agreement or on a periodic (monthly rolling) contract.
Whilst you cannot legally leave your fixed term contract earlier than originally agreed, you can request to vacate the property earlier. This is subject to a landlord’s approval, and usually involves compensation for additional costs and work required to let the property early. You are also still liable for the rent and all obligations set forth in your agreement until a new tenant is found, or your fixed term agreement comes to an end, whichever is first.
If you are on a periodic contract, or coming up to the end of your fixed term, you are able to serve your notice to vacate. Check your documents, a two-month notice is usually required. Please ensure you serve your notice correctly and in line with your tenancy dates. If you are unsure of anything, make sure you speak to your agent or landlord as early as possible to avoid any mistakes.