California Eviction Law
Can My Landlord Evict Me for Calling Code Enforcement in California?
Short answer
No. California law prohibits a landlord from evicting you, raising your rent, or cutting your services to punish you for reporting unsafe or unhealthy conditions to code enforcement. If your landlord takes any of those actions within 180 days of your complaint and you are current on rent, the law presumes the landlord is retaliating, and you can raise retaliation as a defense in your eviction case. Civil Code § 1942.5.
Many California tenants live with mold, broken heat, leaking plumbing, pest infestations, or exposed wiring because they fear that reporting the problem will cost them their home. California law was written to remove that fear. Reporting a habitability problem to your city or county code enforcement agency is a legally protected activity, and a landlord who responds by trying to force you out is engaging in Retaliatory Eviction — conduct that is both a defense to an eviction lawsuit and grounds for a separate claim for damages.
Is It Illegal to Evict a Tenant for Calling Code Enforcement?
Yes. A California landlord may not recover possession of your home, force you to move, raise your rent, or decrease your services in retaliation for a complaint you made to a government agency about the condition of your rental unit. CC § 1942.5(a)
The protection covers complaints made to any "appropriate agency" responsible for housing conditions — typically your city's code enforcement or building and safety department, or your county's environmental health department. It also covers complaints you make directly to your landlord, including a written repair request, an oral complaint about habitability, or notice of a suspected bed bug infestation.
A separate provision independently makes it unlawful for a landlord to raise the rent, decrease services, force you to move, file an eviction lawsuit, or threaten to do any of those things to retaliate against you for lawfully and peaceably exercising any right under the law. CC § 1942.5(d)
How Long Am I Protected After I Call Code Enforcement?
For 180 days. If your landlord serves an eviction notice, files an eviction lawsuit, raises your rent, or reduces your services within 180 days of your protected activity, the law presumes the landlord acted in retaliation, and the landlord must prove a legitimate reason for its actions.
The 180-day period runs from the most recent of the following dates: CC § 1942.5(a)(1)–(5)
- The date you gave your landlord good-faith notice of a needed repair, notice of a suspected bed bug infestation, or an oral complaint about habitability
- The date you filed a written complaint — or an oral complaint that was recorded in writing — with code enforcement or another appropriate agency, if your landlord knew about the complaint
- The date of the resulting inspection or citation, if your landlord did not know about your complaint
- The date you filed a court or arbitration proceeding involving the habitability of your unit
- The date a judgment or arbitration award on habitability was entered against your landlord
The 180-day presumption applies only if you are not in default on your rent, and a tenant may invoke it no more than once in any 12-month period. CC § 1942.5(a)–(b). Your complaint must also be made in good faith. Retaliation that occurs after the 180 days have passed may still be defended under subdivision (d) and California's common-law retaliation doctrine, but without the benefit of the presumption.
What Counts as Retaliation After a Code Enforcement Complaint?
Retaliation is any attempt by your landlord to push you out or penalize you because you reported a habitability problem. Common examples include:
- Serving a 60-Day or 90-Day Notice to Terminate Tenancy shortly after an inspection
- Serving a Three Day Notice to Perform Covenant or Quit over a minor or previously tolerated lease issue
- Filing an Unlawful Detainer Complaint against you
- Serving a notice of rent increase
- Removing parking, laundry access, storage, or other services you previously received
- Threatening to evict you, to call the police on you, or to report you or your family to immigration authorities CC § 1942.5(c)
If your landlord instead changes the locks, removes your belongings, or shuts off your utilities, that conduct is an illegal self-help eviction regardless of motive. CC § 789.3
Can My Landlord Still Evict Me for a Different Reason?
Yes, but only for a genuine, lawful reason stated in good faith. The retaliation statute does not prevent a landlord from acting for any lawful cause, and a landlord may proceed within the 180-day period if its notice and complaint state the ground on which it, in good faith, seeks possession. If you dispute that stated ground, the landlord must prove it is true at trial. CC § 1942.5(f)–(g)
In practice, the timing and the evidence decide these cases. A notice served weeks after an inspection, citing a lease issue your landlord ignored for years, is strong evidence that the stated reason is a pretext. If your tenancy is also covered by the California Tenant Protection Act (AB 1482) or a local just-cause ordinance, your landlord must additionally establish a qualifying just cause to terminate your tenancy. CC § 1946.2
Any lease clause or agreement in which a tenant waives the right to be free from retaliation is void as contrary to public policy. CC § 1942.5(f)
Can My Landlord Demand Rent After a Code Enforcement Citation?
Not if the landlord ignores the citation. A landlord may not demand or collect rent, issue a rent increase, or serve a Three Day Notice to Pay Rent or Quit when all of the following are true: CC § 1942.4(a)
- Your unit substantially lacks a basic habitability requirement or is declared substandard under the Health and Safety Code
- A code enforcement officer inspected the unit and notified your landlord in writing of the obligation to make repairs
- The conditions remain uncorrected more than 35 days after that notice was mailed, without good cause
- You did not cause the conditions
A landlord who violates this rule is liable for your actual damages plus special damages of $100 to $5,000, and the prevailing party recovers attorney's fees and costs. CC § 1942.4(b)
If your landlord files an eviction for nonpayment of rent while cited violations remain uncorrected more than 60 days after the agency's notice, the court presumes the landlord breached the implied warranty of habitability, which can reduce or eliminate the rent the landlord claims you owe. CC § 1942.3
Withholding rent without meeting the legal requirements can expose you to an eviction for nonpayment and can cost you the 180-day retaliation presumption, which requires that you not be in default on rent. Read our guide to repairs, rent withholding, and repair and deduct before withholding any rent.
What if Code Enforcement Orders Me to Move Out?
If a local enforcement agency orders your unit vacated because violations endanger the immediate health and safety of the residents — commonly called a "red tag" — you are entitled to relocation benefits from the owner, and the agency determines your eligibility. H&S Code § 17975
The relocation payment equals two months of the area's fair market rent as determined by the U.S. Department of Housing and Urban Development, plus an amount for utility service deposits, and it is paid in addition to the return of your security deposit. H&S Code § 17975.2 The owner generally must pay within 10 days after the order to vacate is mailed and posted, or at least 20 days before the vacate date, whichever is later. H&S Code § 17975.1
How Do I Raise Retaliation as a Defense to My Eviction?
You raise retaliation by asserting it as an affirmative defense in the Answer you file in response to the Unlawful Detainer Summons. Most California tenants have only 10 court days to file that Answer. A defense that is not raised in your Answer may be lost.
- Check the retaliation defense on Judicial Council Form UD-105 and state the supporting facts, including the date of your complaint and the date of the landlord's notice or lawsuit. See how to fill out the Answer.
- Raise any related defenses, such as breach of the warranty of habitability, and, if your tenancy is covered, the absence of just cause under AB 1482 or a local ordinance. See affirmative defenses available to tenants.
- Bring your evidence to trial: your complaint, the agency's inspection report or notice of violation, and the landlord's notice, matched by date.
Separately, a landlord who retaliates is liable for your actual damages and, where the landlord acted with fraud, oppression, or malice, punitive damages of $100 to $2,000 for each retaliatory act. If either party requests attorney's fees at the start of a damages action, the court awards reasonable fees to the prevailing party. CC § 1942.5(h)–(i) For a detailed treatment of burdens of proof, case law, and the common-law defense, see our full guide on defending against a retaliatory eviction.
What Should I Do Before and After I Call Code Enforcement?
Build a dated paper trail at every step, because a retaliation defense turns on proving when you complained and when your landlord responded.
- First, notify your landlord of the problem in writing — by e-mail, text, or letter — and keep a copy. This written notice independently starts the 180-day protection period.
- Second, photograph and video the conditions, with dates, before and after any repair attempt.
- Third, file your complaint with code enforcement in writing or through the agency's online portal, and write down the case or complaint number, the date, and the name of anyone you spoke with.
- Fourth, keep paying your rent on time and keep proof of every payment. Being current on rent preserves the 180-day presumption.
- Fifth, request a copy of the inspection report and any notice of violation issued to your landlord.
- Sixth, calendar the date 180 days after your most recent protected activity, and save every notice, text, or letter your landlord sends you after the complaint.
- Seventh, call Tenant Eviction Defense as soon as you receive any notice to terminate, notice of rent increase, or court papers.
Frequently Asked Questions
Can my landlord find out that I called code enforcement?
Often, yes. Code enforcement typically contacts the owner to arrange an inspection and issues any notice of violation to the owner, so your landlord may learn of or infer your complaint. That is precisely why California law prohibits retaliation for it.
Can my landlord raise my rent after I report code violations?
Not in retaliation. A rent increase within 180 days of your complaint is presumed retaliatory if you are current on rent, and a landlord may not issue a rent increase at all while cited violations remain uncorrected, without good cause, more than 35 days after the agency's written notice. Civil Code §§ 1942.4 and 1942.5.
What if I am behind on rent when I call code enforcement?
The 180-day retaliation presumption under Civil Code § 1942.5(a) does not apply to a tenant in default on rent. You may still have other defenses, including breach of the warranty of habitability, and your landlord may be barred from demanding rent under Civil Code § 1942.4 if cited conditions go uncorrected.
Does retaliation protection apply after 180 days?
The presumption ends after 180 days, but retaliation remains unlawful. After that period, you may still raise retaliation under Civil Code § 1942.5(d) or California's common-law retaliation doctrine, though you bear the burden of producing evidence that the landlord's conduct was retaliatory.
If your landlord has served you with a notice or filed an eviction lawsuit after you contacted code enforcement, and you have received an Unlawful Detainer Summons or a Notice of Unlawful Detainer in the mail from the Court, call our Eviction Defense Rapid Response Line immediately at (657) 510-6534, Monday through Friday from 8:30 a.m. to 6:00 p.m. Time is working against you — do not wait.
Updated September 23, 2026.
Tenant Eviction Defense is a nonprofit organization. This article is general legal information about California law, not legal advice, and reading it does not create an attorney–client relationship. Deadlines and local rules change. Confirm anything time-sensitive with the court named on your summons or with a licensed California attorney before you rely on it.

