In optics, optical elements are used to transform, to filter or to process physical wavefronts in order to magnify images, compensate for aberration or to suppress unwanted diffracted order for example. Because digital holography provides numerical wavefronts, we developed a digital optics, involving numerical elements such as numerical lenses and pinholes, to mimic numerically what is usually done physically, with the advantage to be able to define any shape for these elements and to place them everywhere without obstruction problems. We demonstrate that automatic and non-automatic procedures allow diffracted order or parasitic interferences filtering, compensation for aberration and image distortion, and control of position and magnification of reconstructed wavefront. We apply this digital optics to compensate for chromatic aberration in multi-wavelength holography in order to have perfect superposition between wavefronts reconstructed from digital hologram recorded with different wavelengths. This has a great importance for synthetic wavelength digital holography or tomographic digital holography that use multiple wavelengths.