The P0171 code stands for "System Too Lean (Bank 1)". Your engine computer (the ECU) sees too much oxygen in the exhaust compared with the fuel it is injecting, so it keeps adding fuel to compensate, until it reaches its limit and turns on the check engine light. It is one of the most common codes I see in the shop, and one of the most misdiagnosed, because the part that reports the problem (the oxygen sensor) is very rarely the part that causes it.
This guide explains what the code really means, whether you can keep driving, and the order I follow to find the cause before buying any part.
What the P0171 code means
A gasoline engine runs best close to the ideal air-fuel ratio (about 14.7 parts of air for 1 part of fuel). The upstream oxygen sensor reads the exhaust, and the ECU corrects the amount of fuel injected in real time. Those corrections are called fuel trims:
- Short term fuel trim (STFT) is the instant correction, changing many times per second.
- Long term fuel trim (LTFT) is the learned correction the ECU keeps in memory.
A positive trim means the ECU is adding fuel. A few percent either way is normal. When the long term trim climbs past the limit set by the manufacturer, often somewhere around +20% to +25%, the ECU decides it cannot correct the mixture anymore and stores P0171 System Too Lean Bank 1.
In other words, the engine is receiving more air than the computer measured, or less fuel than it asked for. The oxygen sensor is only the messenger: it is reporting a real excess of oxygen.
"Bank 1" is the side of the engine with cylinder number 1. On a four-cylinder inline engine there is only one bank, so P0171 concerns the whole engine. On a V6 or V8, the other side is bank 2, and its lean code is P0174.
Can you drive with a P0171 code?
In the short term, yes, if the car runs normally. If there is no jerking, no strong hesitation and no limp mode, you can drive it to a shop or use it for a few days while you book a diagnosis.
In the long term, no. A lean mixture burns hotter. Over time, that means:
- higher combustion temperatures and overheated exhaust valves;
- engine knock (pinging) under load, which can damage pistons;
- misfires, and unburned fuel that overheats and destroys the catalytic converter. A cheap vacuum hose left unrepaired can end up costing you a converter and a P0420 code.
Will a P0171 code clear itself?
The light can go out on its own if the cause disappears, for example a hose that only leaks when the engine is cold. On many cars the ECU turns the light off after a few consecutive trips without detecting the fault, but the code stays in memory, and it comes back as long as the real cause is still there. Clearing the code with a scanner does not fix anything: it only resets the learned fuel trims.
Symptoms of a P0171 code
- Check engine light, sometimes on and off.
- Rough or hunting idle, especially when the engine is warm or just after a cold start.
- Hesitation or lack of power at low engine speed or under load.
- A hissing or whistling noise at idle (typical of a torn PCV diaphragm or a split hose).
- Occasional misfires, sometimes with a P0300 code at the same time.
- On some cars, no symptom at all except the light.
Common causes of P0171, from most to least likely
- Vacuum leak after the airflow sensor: split PCV (crankcase breather) hose, cracked vacuum line, brake booster hose, intake manifold gasket, throttle body O-ring. This is by far the most frequent cause in my experience.
- Dirty or faulty airflow measurement: a MAF sensor (mass airflow) contaminated by oil vapor, or a fouled MAP sensor on engines that use one. The sensor under-reads the air, so the ECU injects too little fuel.
- Weak fuel delivery: clogged fuel filter, tired fuel pump, faulty pressure regulator, dirty injectors. Usually the trims get worse under load rather than at idle.
- Exhaust leak before the upstream O2 sensor: outside air is pulled into the exhaust and the sensor reads a false lean condition.
- Unmetered air from other systems: on some engines, a stuck EVAP purge valve or a faulty EGR valve can let in air the ECU does not account for.
- The upstream O2 sensor itself: possible, but rare. A slow or biased sensor can cause P0171, but it should be the last suspect, not the first.
A loose gas cap is often blamed online, but it usually sets EVAP codes (such as P0455 or P0457), not P0171.
Quick reference: causes, tests and fixes
| Cause | How to confirm it | Typical fix |
|---|---|---|
| Vacuum leak (PCV hose, gasket, vacuum line) | High trims at idle that drop at 2,500 rpm, smoke test | Replace the hose or gasket |
| Dirty MAF or MAP sensor | Trims high across the rev range, sensor reading low | Clean with dedicated sensor cleaner, replace with an OEM part if needed |
| Weak fuel delivery | Trims worse under load, low fuel pressure on a gauge | Fuel filter, regulator, pump or injectors |
| Exhaust leak before the O2 sensor | Visual check, soot marks, ticking noise | Repair the leak or gasket |
| Faulty upstream O2 sensor | Slow or stuck signal after all leaks are ruled out | Replace the sensor |
How a technician diagnoses P0171, step by step
The golden rule: no part is replaced before the cause is proven. Here is the order I follow.
Step 1: Read the freeze frame and the fuel trims
Connect a scan tool and look at the freeze frame data (the conditions when the code was set), then watch STFT and LTFT live:
- At idle, if the long term trim is very high (for example +25%) and it drops back toward 0% when you hold 2,500 rpm, it is almost always a vacuum leak. The leak lets in a fixed amount of air, which matters a lot at idle and very little at higher airflow.
- Under load or while driving, if the trims stay high or get worse at higher rpm, look at the fuel supply (weak pump, clogged filter, low pressure) or at a MAF sensor that under-reads the airflow.
This single step tells you which half of the system to investigate.
Step 2: Visual and mechanical inspection
Check every vacuum hose, the air filter box and its clips, the intake duct between the airflow sensor and the throttle body, the intake manifold gaskets and the PCV hoses. Many leaks hide under the air box or behind the intake manifold, where you cannot see them without a light and a mirror.
Step 3: The smoke test
This is the most effective tool for P0171. A smoke machine pushes visible smoke at low pressure into the intake. The smoke escapes immediately from the smallest crack in a hose, a dry gasket or a split plastic part. Leaks that are invisible to the eye show up in seconds.
Step 4: The spray test
With the engine idling, I spray small bursts of brake cleaner or starting fluid around the injector seals and the intake manifold gaskets. If the idle speed suddenly changes or smooths out, the spray was sucked in through the leak, and you have found its exact location.
Safety: these products are highly flammable. Never spray near the exhaust manifold, the ignition coils or any hot part, use very short bursts, and keep a fire extinguisher within reach. If you are not comfortable with this, use a smoke test instead.
Step 5: Check fuel pressure
If the trims point to the fuel side, connect a fuel pressure gauge on the fuel rail and check pressure and flow at idle and under different loads, against the manufacturer's specification. A pressure that drops under load points to the pump, the filter or the regulator.
Real P0171 cases from my shop
These are cars I diagnosed myself. They are not all sold in the US, but the method is exactly the same on any gasoline engine.
- Dacia Logan 1.4 MPI, 145,000 km (about 90,000 miles): check engine light on and off, slightly unstable idle when warm. The cause was a micro-crack in the PCV breather hose plus a throttle body O-ring hardened by heat. Air was entering after the airflow measurement, so the ECU never accounted for it.
- Renault Clio 3 1.2 16V, 180,000 km (about 112,000 miles): light on every time at steady highway speed, with occasional misfires. This engine uses a MAP sensor rather than a MAF. The sensor was fouled by oil vapor, and the low-quality air filter was not properly clipped in place, which distorted the injection calculation.
- Volkswagen Golf 5 1.6 FSI, 210,000 km (about 130,000 miles): lack of power at low rpm, P0171 sometimes with P0300. The fuel filter with its built-in pressure regulator was partly clogged, and the high-pressure injectors were slightly fouled, so the engine was short of fuel under heavy load.
- Ford Focus 2 1.6 16V: hunting idle and a permanent P0171. The smoke test showed smoke coming out of a crack, invisible to the naked eye, in the rubber elbow of the PCV hose under the plastic intake manifold. A new hose costing about 200 MAD (roughly $20) fixed the problem instantly.
P0171 and P0174 together
P0174 is the same fault, "System Too Lean (Bank 2)", on the other side of a V6 or V8 engine. When P0171 and P0174 appear at the same time, look for a cause that affects the whole engine, not one side:
- a large vacuum leak on the common intake (PCV system, brake booster hose, intake plenum gasket);
- a dirty or faulty MAF sensor, which feeds both banks;
- low fuel pressure from a weak pump, a clogged filter or a faulty regulator.
Two banks rarely develop separate leaks at the same moment, so a single shared cause is much more likely.
How to fix P0171 (and what does not work)
What actually fixes it
- Replacing the cracked hose, PCV elbow, gasket or O-ring found by the smoke test.
- Cleaning the MAF sensor with a dedicated MAF cleaner (never touch the sensing element), or replacing it with a quality OEM part if cleaning does not bring the readings back.
- Restoring fuel delivery: filter, regulator, pump or injectors, depending on what the pressure test showed.
- After the repair, clearing the codes, resetting the fuel trims and checking on a test drive that the long term trim comes back close to 0%.
What does not work
- Replacing the upstream O2 sensor first. This is the classic trap. The scan tool shows a lean condition, the sensor gets replaced, and the code is back after 50 km (about 30 miles), because the old sensor was simply reporting real excess oxygen.
- Fitting a cheap, uncalibrated MAF sensor. A low-cost replacement often reads worse than the dirty original and makes the fuel trims even more wrong.
- Forgetting the EVAP purge valve and the EGR valve on engines where they can let in unmetered air.
- Just clearing the code. It hides the problem while the lean mixture keeps heating the engine and the converter.
P0171 on Toyota, Ford and Chevy
The diagnosis order never changes, but some engine families have well-known weak spots. Here is what I see most often in the shop on the brands people search for most.
Toyota (Corolla 1.6 and 1.8 VVT-i, Yaris)
- Intake manifold gasket seals. With years of heat cycles, the rubber seals harden, flatten and stop sealing. The typical sign: the light comes on in the morning when the engine is cold, or at idle just after a start. As the engine warms up, the materials expand, the leak partly closes and the trims improve, before going high again on the highway.
- MAF sensor on 1ZZ-FE and 2ZR-FE engines. It is very sensitive to oil vapor, especially when an oiled performance air filter has been installed.
Ford (Focus and Fiesta 1.6 and 2.0 Duratec)
- Split PCV hose or brake booster vacuum hose, usually at a molded elbow hidden under the air filter box or behind the intake manifold. The Focus case above is a perfect example: the crack was invisible until the smoke test.
Chevrolet / GM (Cruze 1.6 and 1.8, Aveo, Captiva)
- Torn PCV diaphragm built into the valve cover. When the plastic diaphragm tears, it sets P0171 and often causes a high-pitched whistle at idle and strong suction if you open the oil filler cap with the engine running. The fix is usually to replace the complete valve cover, because the diaphragm is not always sold separately.
How much does it cost to fix a P0171 code?
The bill depends entirely on the cause, and the most common causes are also the cheapest. Typical US shop prices published by FIXD (parts and labor, which vary by vehicle and location):
| Repair | Typical shop cost (US) |
|---|---|
| Vacuum line | $200 to $300 |
| MAF sensor cleaning | $100 to $200 |
| MAF sensor replacement | $239 to $346 |
| Fuel filter | $175 to $211 |
| Fuel pressure regulator | $266 to $322 |
| Oxygen sensor | $362 to $412 |
| Fuel injector | $644 to $784 |
A fuel pump is usually the most expensive repair on the list. For reference, in the shops I work with in Morocco, a diagnosis with scan tool and smoke test costs 150 to 300 MAD, a vacuum or breather hose 100 to 350 MAD fitted, throttle body cleaning with new intake gaskets 300 to 600 MAD, and an in-tank fuel pump 600 to 1,800 MAD depending on the model. Labor rates are much lower than in the US, but the proportions are the same: finding the leak is cheap, guessing is expensive.
Before paying for a pump, injectors or an O2 sensor, make sure the shop has read the fuel trims and done a smoke test.
For other trouble codes explained the same way, browse the OBD2 codes guides, or read who writes these guides.
Frequently asked questions
Can a bad O2 sensor cause a P0171 code?
It can, but it is rare. In most cases the upstream O2 sensor is correctly reporting a real lean condition caused by a vacuum leak, a dirty MAF sensor or weak fuel delivery. Replace it only after those causes have been ruled out.
Can a dirty MAF sensor cause P0171?
Yes. A MAF sensor contaminated by oil vapor or dust under-reads the incoming air, so the ECU injects too little fuel. Cleaning it with a dedicated MAF cleaner often fixes the problem.
Will a P0171 code clear itself?
The light can turn off after a few trips if the fault stops occurring, but the code stays in memory and comes back as long as the cause is still there.
What causes P0171 and P0174 at the same time?
A cause shared by both banks of a V6 or V8 engine: a large vacuum leak on the common intake, a dirty MAF sensor or low fuel pressure.
Can I drive with a P0171 code?
For a short time, if the car runs normally. Over the long term, the lean mixture raises combustion temperatures and can cause knock, overheated valves and a damaged catalytic converter.
How much does it cost to fix a P0171 code?
Usually between about $100 and $400 for the common causes such as a vacuum hose or a MAF sensor, and much more if the fuel pump or injectors are at fault. A smoke test before buying parts is the cheapest way to avoid overspending.
