An electrochemical cell has been designed for powder X-ray diffraction studies of lithium ion batteries (LIB) and sodium ion batteries (SIB) in operando with high time resolution using a conventional powder X-ray diffractometer. The cell allows for studies of both anode and cathode electrode materials in reflection mode. The cell design closely mimics that of standard battery testing coin cells and allows obtaining powder X-ray diffraction patterns under representative electrochemical conditions. In addition, the cell uses graphite as the X-ray window instead of beryllium, and it is easy to operate and maintain. Test examples on lithium insertion/extraction in two spinel-type LIB electrode materials (Li4Ti5O12 anode and LiMn2O4 cathode) are presented as well as first results on sodium extraction from a layered SIB cathode material (Na0.84Fe0.56Mn0.44O2).