Porous silicon (PS) layers can easily be formed by an electrochemical etch process using a mixture of hydrofluoric acid (HF) and ethanol. The microstructure and porosity of the layers depend on the HF concentration, the doping level of the substrate and the current density applied during the etch process. Changing the current density during the etch process will result in a well defined layer structure consisting of layers with different porosities. Each single layer can be treated as an effective medium exhibiting a refractive index depending mainly on the porosity of the layer. Using reflectance measurements we have investigated the dependence of the refractive index of PS layers on the formation current density for different substrates. In addition the etch rate was determined by thickness measurements with an electron microscope. Based on these results various kinds of optical interference filters were studied. We have formed samples consisting of discrete single layers with different porosities (e.g. Bragg reflectors) as well as samples with continuous variation of the refractive index (rugate filters). Combining these PS filters with standard photolithography steps, microoptical devices such as spectral sensitive photodiodes can be realized.