We demonstrate a simple method for the determination of the magnetic field in an ion trap using laser-cooled 9 Be + ions. The method is not based on magnetic resonance and thus does not require delivering radiofrequency (RF) radiation to the trap. Instead, stimulated Raman spectroscopy is used, and only an easily generated optical sideband of the laser cooling wave is required. The d.c. magnetic vector, averaged over the 9 Be + ion ensemble, is determined. Furthermore, the field strength can be minimized and an upper limit for the field gradient can be determined. The resolution of the method is 0.04 G at present. The relevance for precision rovibrational spectroscopy of molecular hydrogen ions is briefly discussed.