A battery is a device that stores chemical energy and converts it to electrical energy. ... The flow of electrons provides an electric current that can be used to do work. To balance the flow of electrons, charged ions also flow through an electrolyte solution that is in contact with both electrodes.