The recent electron recoil excess observed by XENON1T has a possible interpretation in terms of solar axions coupled to electrons. If such axions are still relativistic at recombination they would also leave a cosmic imprint in the form of an additional radiation component, parameterized by an effective neutrino number $Delta N_text{eff}$. We explore minimal scenarios with a detectable signal in future CMB surveys: axions coupled democratically to all fermions, axion-electron coupling generated radiatively, the DFSZ framework for the QCD axion. The predicted $Delta N_text{eff}$ is larger than $0.03-0.04$ for all cases, close to the $2sigma$ forecasted sensitivity of CMB-S4 experiments. This opens the possibility of testing with cosmological observations the solar axion interpretation of the XENON1T excess.