When You Get Your Deposit Back
After the end of your tenancy, you have the right to a refund of your Mietkaution (maximum 3 net monthly rents — payment details are described in the article Kaution). There is no fixed statutory deadline, but case law accepts a 3–6 month inspection period, and around 6 months is the upper limit without special reasons.
Deductions and Nebenkostenabrechnung
The landlord may retain the deposit for documented claims (unpaid rent, damage beyond normal wear and tear). If the annual Nebenkostenabrechnung (utility cost settlement) is not yet available, they may withhold a reasonable portion — usually equivalent to 3–4 months of advance payments — until the settlement; the deadline can then reach up to 12 months. The conditions for deductions are specified in your Mietvertrag; the amount of advance payments is explained in the article on additional costs, so it's worth checking.
Interest and Statute of Limitations
According to §551 BGB, the landlord must pay interest on the deposit, and the interest belongs to you and is paid along with the refund. Your claim for the return expires after 3 years (from the end of the year in which it became due). After moving out, make sure to deregister so that your money and documents reach the correct address.