After the rental agreement ends.
DATCP explains that the clock can run from the end of the agreement or the date a new tenant moves in, whichever comes first.
Do not assume “key return date” is always the deadline trigger
An early surrender can leave the rental agreement running. Preserve the lease end date and any proof that a replacement tenant moved in, because those facts can control the 21-day calculation.
Compare this topic across states
Official sources
Official Wisconsin consumer guidance covering the 21-day deposit timeline, permissible withholdings, itemization and routine carpet-cleaning treatment.
Wisconsin Department of Agriculture, Trade and Consumer ProtectionLandlord-Tenant Guide — Security Deposits ↗Official agency guide explaining ATCP 134.06 deposit return and withholding rules.