In this Letter, we propose an on-line inspection method based on a plenoptic camera to detect and locate flaws of optics. Specifically, due to the extended depth of field of the plenoptic camera, a series of optics can be inspected efficiently and simultaneously. Moreover, the depth estimation capability of the plenoptic camera allows for locating flaws while detecting them. Besides, the detection and location can be implemented with a single snapshot of the plenoptic camera. Consequently, this method provides us with the opportunity to reduce the cost of time and labor of inspection and remove the flaw optics, which may lead to performance degradation of optical systems.