Exactly how long you get to legally stay in your home after a foreclosure sale depends on state law: In some states, your right to live in the home ends shortly after the foreclosure sale. In others, a foreclosed homeowner may stay in the property during a post-sale redemption period, which could be several months, or until some other action, like confirmation of the foreclosure sale, takes place.
If you don't vacate the home after your legal right to live there ends, though, whoever bought the property at the foreclosure sale (typically, the foreclosing bank) will evict you.
To evict foreclosed homeowners after a nonjudicial foreclosure, the bank has to file a proceeding (a lawsuit) that's separate from the foreclosure action. Before filing the suit, the bank typically has to give notice, sometimes called a "notice to quit." The notice to quit gives the foreclosed homeowner a specific amount of time, like three days under California law, for example, to leave the property. Generally, the notice will give between three and 30 days.
If the foreclosed owner doesn't move out, the bank then files an eviction lawsuit. This suit is often called an "unlawful detainer" or "forcible entry and detainer" action. An eviction procedure might take a few months, which gives you some more time in your house payment-free.
But forcing the new owner of the home to evict you in court has its downside. It's often best to move out at the end of the period set out in the written notice instead of waiting until the new owner goes to court and gets an eviction order. If you're sued, it's a matter of public record and can hurt your ability to rent or lease in the future. You'll already have bad credit as a result of the foreclosure—and bankruptcy if you go that route—and many landlords subscribe to private databases that screen prospective tenants for being the subject of previous eviction lawsuits. That fact, above all others, can lead a potential landlord to turn down your application for a lease or rental agreement.
In some states, the bank can include an eviction as part of a judicial foreclosure. When an eviction is an extension of the foreclosure action, it can happen quickly. If the foreclosing bank is the purchaser at the foreclosure sale, the bank then asks the court for what's called a "writ of possession" or a "writ of assistance." The writ is a court order telling the sheriff to remove you from the home. Typically, the sheriff will post a notice on the front door giving you 24 hours to leave. If you don't move out by the deadline, the sheriff's crew may physically remove you and your belongings from the property.
Foreclosure laws vary widely from state to state. To find out the eviction process after a foreclosure in your state, consider talking to a foreclosure attorney.