OptaDOS: a tool for obtaining density of states, core-level and optical spectra from electronic structure codes. We present OptaDOS, a program for calculating core-electron and low-loss electron energy loss spectra (EELS) and optical spectra along with total-, projected- and joint-density of electronic states (DOS) from single-particle eigenenergies and dipole transition coefficients. Energy-loss spectroscopy is an important tool for probing bonding within a material. Interpreting these spectra can be aided by first principles calculations. The spectra are generated from the eigenenergies through integration over the Brillouin zone. An important feature of this code is that this integration is performed using a choice of adaptive or linear extrapolation broadening methods which we show produces higher accuracy spectra than standard fixed-width Gaussian broadening. OptaDOS may be straightforwardly interfaced to any electronic structure code. OptaDOS is freely available under the GNU General Public licence from http://www.optados.org.