We report X-ray absorption near edge structures (XANES) study of CeAl2 thin films of various thicknesses, 40–120 nm, at Al K- and Ce L3-edges. The threshold of the absorption features at the Al K-edge shifts to the higher photon energy side as film thickness decreases, implying a decreased in Al p-orbital charges. On the other hand, from Ce L3-edge spectra, we observed a decrease in the 5d4f occupancy as the surface-to-bulk ratio increases. The valence of Ce in these thin films, as revealed by the Ce L3-edge spectral results, is mainly trivalent. From a more detailed analysis we found a small amount of Ce4+ contribution, which increases with decreasing film thickness. Our results indicate that the surface-to-bulk ratio is the key factor which affects the electronic structure of CeAl2 thin films. The above observations also suggest that charge transfer from Al to Ce is associated with the decrease of the film thickness.