Abstract. A portable detecting device was developed for the magnetic detection of cracks existing in railway tracks. The device is equipped with permanent magnets, which produce a uniform magnetic field inside and near the surface of the magnetically soft steel of a railway track, and GMR sensors. Due to the high sensitivity of the GMR sensors (in variations of the tangential component of the magnetic field which is parallel to the direction of motion) the device is capable of producing voltage peaks or dips, for quite small deviations of the near-surface magnetic field from the uniform field of the magnets. Finite element numerical simulations showed that the tangential component of the magnetic field exhibits sharp peaks above cracks, due to the stray magnetic field produced by them. Laboratory measurements, made on pieces of railway tracks with cracks, reproduced qualitatively the results of simulations. They showed that the sensors (moving near cracks) produce sharp voltage peaks with magnitude that depends on the size of the cracks. Based on these measurements, we conclude that the developed device can successfully detect cracks and defects in railway tracks and give information on their size. The method can be generalised for detection of cracks in all magnetic steels.