We report a method to detect and to measure the size and velocity of elongated bubbles or drops in a dispersed two-phase flow. The difference of the magnetic susceptibilities between two phases causes a force on the interface between both phases when it is exposed to an external magnetic field. The force is measured with a state-of-the-art electromagnetic compensation balance. While the front and the back of the bubble pass the magnetic field, two peaks in the force signal appear, which can be used to calculate the velocity and geometry parameters of the bubble. We achieve a substantial advantage over other bubble detection techniques because this technique is contactless, non-invasive, independent of the electrical conductivity and can be applied to opaque or aggressive fluids. The measurements are performed in an inclined channel with air bubbles and paraffin oil drops in water. The bubble length is in the range of 0.1–0.25 m and the bubble velocity lies between 0.02–0.22 m s−1. Furthermore we show that it is possible to apply this measurement principle for nondestructive testing (NDT) of diamagnetic and paramagnetic materials like metal, plastics or glass, provided that defects are in the range of 10‒2 m. This technique opens up new possibilities in industrial applications to measure two-phase flow parameters and in material testing.