We have found a blueshift in the cavity modes confined in two-dimensional photonic crystal microcavities when the thickness of the slab was varied uniformly by accurate dry etching. The shifts in the wavelength of the cavity modes were around 2 nm towards shorter wavelengths per nanometer reduced in the thickness of the slab. Three-dimensional plane wave expansion calculations showed that the observed shifts are inside the calculated photonic band gap of the structures. The variation in the energy position of the peaks with the thickness has been analyzed by three-dimensional finite difference time domain calculations for a one missing hole microcavity. This tuning of the emission wavelength with the change in the thickness slab shows the important effect of the third dimension in photonic crystals made out of semiconductor slabs and it can be of interest for its application in the final processed photonic devices like photonic crystal lasers.