Quantum fluctuations give rise to van der Waals and Casimir forces that dominate the interaction between electrically neutral objects at sub-micron separations. Under the trend of miniaturization, such quantum electrodynamical effects are expected to play an important role in micro- and nano-mechanical devices. Nevertheless, utilization of Casimir forces on the chip level remains a major challenge because all experiments so far require an external object to be manually positioned close to the mechanical element. Here by integrating a force-sensing micromechanical beam and an electrostatic actuator on a single chip, we demonstrate the Casimir effect between two micromachined silicon components on the same substrate. A high degree of parallelism between the two near-planar interacting surfaces can be achieved because they are defined in a single lithographic step. Apart from providing a compact platform for Casimir force measurements, this scheme also opens the possibility of tailoring the Casimir force using lithographically defined components of non-conventional shapes.