Porous silicon optical rugate filters are electrochemically fabricated to display reflectance peaks in the medium-wavelength infrared (MWIR) region from 4 to 8 μm. Etching conditions are adjusted to create filters with single and multiple infrared reflectance peaks overlapping specific infrared chemical absorbance bands. Additional infrared reflectance peaks are designed into the structures to provide internal optical reference channels. Samples containing optical reflectance features matching the absorbance band of CO2 at 2350 cm−1 are used to demonstrate gas sensing with optical filters, and a structure with a photonic stop band tuned to match the infrared absorbance band of the P=O functional group, found in G-series chemical warfare agents, is fabricated. With adequate electrolyte replenishment, the calibrated etch conditions generated reproducible spectral band features even for relatively long etch durations. This work represents the first example of a porous Si spectral filter prepared to match specific spectral features of molecules in the MWIR (“fingerprint”) region.