The optical implementation of a median filter for optical digital signal and image processing is proposed. The filter is implemented using polarization-coded symbolic substitution logic (SSL) and consists of a thresholder and a summing lens. The implementation of the median filter utilizes two properties of median filters, namely, the threshold decomposition and the stacking property. The thresholder decomposes the M-valued incoming signal into a set of M-1 binary sequences by thresholding the signal at M-1 levels. These binary sequences are then applied to a set of binary median filters, the outputs of which are added together (stacked) one sample at a time by use of the summing lens. The proposed optical implementation offers an increased throughput compared with the conventional electronic implementation by taking full advantage of the parallelism offered by SSL and the inherent massive parallelism of optics.