How do I know if my O2 sensor is bad?

Common signs include poor fuel economy, rough idle, failed emissions test, rotten egg smell from the exhaust, and a Check Engine light with codes P0130-P0167. An OBD2 scanner showing a flat or sluggish O2 sensor waveform on live data also indicates a faulty sensor.