An optical device includes: (1) an emitter; (2) a detector disposed adjacent to the emitter; (3) an encapsulation layer encapsulating the emitter and the detector; (4) a dielectric layer disposed on the emitter, the detector and the encapsulation layer; (5) a redistribution layer disposed on the dielectric layer and electrically connected to the emitter and the detector; and (6) a light shielding structure disposed on the encapsulation layer and corresponding to a location between the emitter and the detector.