How OBD2 Diagnostic Codes Are Generated
6 min read · by Nicole Bennett · Last updated: November 14, 2026
How OBD2 diagnostic codes are generated starts with the vehicle’s engine control unit, which compares sensor readings with set limits and stores a code when a reading stays out of range. The scanner you plug in only reads what the computer has already saved.
Understanding this process helps you read a code correctly. A code points to the system that flagged a problem, and the exact cause still needs a diagnosis.
This article gives general information about how the system works. It does not explain how to repair any specific fault, and your owner’s manual or a qualified technician should guide any repair.
The Engine Control Unit Creates the Code
The vehicle’s engine control unit (ECU) generates OBD2 codes, not the scanner. Sensors send signals to the ECU, which compares each reading with its programmed limits. A vehicle diagnostics guide on how these codes are generated describes the same sequence, from sensor signal to stored code.
OBD-II exposes data from the ECU. Emission-related codes are stored there, and some stay in memory when they turn on the warning lamp. That is why a code can still be available after the light turns off, depending on the fault and the monitor involved. Each monitored system is checked on its own schedule, using tests the manufacturer programmed into the ECU. Some checks run continuously, while others run only under specific conditions, such as steady driving after the engine warms up.
How a Pending Code Becomes a Confirmed Code
A single odd reading does not always turn into a stored fault. The ECU usually waits to see whether the problem comes back, which is why the first record is often a pending code and only later a confirmed one. Because a pending code may not light the warning lamp, it is easy to miss unless someone reads the pending mode.
- A sensor reading moves outside the limit the ECU expects.
- The ECU stores a pending code from the current or last completed drive cycle.
- The fault appears again on later drive cycles.
- The ECU confirms the code, and the check engine light may come on.
The same guide says confirmation often takes several drive cycles. Scope boundary: the exact monitoring logic differs by manufacturer and by the system being checked, so the timing for one car may not match another.

Reading the Five-Character Code
Every OBD2 trouble code uses a letter followed by four characters. The Wikipedia overview of on-board diagnostics describes how each position is used, and the structure is the same across the code families.
| Position | What it tells you | Example |
|---|---|---|
| 1st character | The system: P powertrain, B body, C chassis, U network | P for powertrain |
| 2nd character | Generic (SAE-defined) or manufacturer-specific | 0 means a generic code |
| 3rd character | The vehicle subsystem, such as fuel, air or ignition | Depends on the code |
| 4th and 5th characters | The specific fault within that subsystem | Varies by code |
Manufacturers often add their own codes to the standard set. A code that is not generic may have a meaning that changes from one brand to another, so check the make and model before you rely on a definition. Two codes can share the same system letter and still point to different faults, so the last two characters matter as much as the first. A full list of code prefixes is in car diagnostic codes list.
How Scanners Read the Stored Data
A scanner asks the ECU for data using standard service modes. Each mode returns a different slice of what the computer has stored, so a basic reader and a full scan tool can show different information from the same car.
- Mode 03 reads confirmed codes
- Mode 07 reads pending codes from the current or last completed drive cycle
- Mode 06 returns on-board monitoring test results
- Mode 04 clears codes, pending codes and freeze-frame data
Technicians often use pending codes to check whether a repair worked. Clearing codes with mode 04 erases the stored information, so record the codes and freeze-frame data before you clear anything. Codes that survive a clear are covered in OBD2 permanent codes explained. Basic readers may show only confirmed codes, while a fuller scan tool can request pending codes and live data. Check which modes your reader supports before you assume a clean result means no pending fault.

What a Code Does Not Tell You
A code identifies the system that flagged a problem, not necessarily the part that failed. A P0 code about an oxygen sensor circuit, for example, may come from wiring, the connector or the sensor itself. For the split between standard and maker codes, see generic vs enhanced OBD2 codes.
Freeze-frame data is a snapshot of engine conditions saved when a code was set, such as engine speed, load and coolant temperature. Comparing it with the conditions you see during a test helps show what set the code.
A common mistake is replacing a part based on the code alone. Read the freeze-frame data, check live sensor values and confirm the fault before you buy parts.
Frequently Asked Questions
Does the scanner create the OBD2 code?
No. The vehicle’s ECU creates and stores the code when sensor readings stay outside the expected limits. A scanner only requests and displays what the ECU has saved.
What is the difference between a pending and a confirmed code?
A pending code is stored after the first out-of-range reading. A confirmed code means the fault returned on later drive cycles, and the check engine light may then come on.
Are all OBD2 codes the same across car brands?
Many basic codes are standardized, but manufacturers add their own codes with their own meanings. Check the make and model before you rely on a code definition.
Does clearing a code fix the problem?
No. Clearing removes the stored information but not the fault. If the condition is still present, the code can return on later drive cycles. Clearing also resets the readiness monitors, so the car may need a drive cycle before those tests report again.
Record the codes and freeze-frame data before any repair, because the stored information is what a technician needs to confirm the fault.
-
Nicole Bennett, Technical Content Editor at BestOBD2Picks Nicole turns OBD-II standards, service bulletins, and repair data into step-by-step diagnostic guides anyone can follow. Technical Content Editor
Related guides
LearnP0430 Nissan Bank 2: Catalyst Efficiency Code Explained
LearnWhat Does a Car Diagnostic Tell You? Codes, Data and Limits
LearnCar Diagnostic Codes List: How to Read P, B, C and U Codes
LearnPolaris Diagnostic Codes: How to Read Them Yourself
LearnJeep Wrangler Driver Door Not Unlocking: Check the Handle Wiring
LearnBest OBD2 Scanner for Fiat: Picks and Model Limits to Check