A kind of novel and compact magnetic field sensor has been proposed and investigated experimentally. The proposed sensor consists of a tapered single mode fiber coupled with a nanostructured magnetic fluid-infiltrated photonic crystal fiber, which is easy to be fabricated. The response of magnetic fluid to magnetic field is used to measure the intensity of magnetic field via whispering gallery mode. The magnetic field-dependent shift in resonance wavelength is observed. The maximum magnetic field intensity sensitivity is 53 pm/mT. The sensor sensitivity is inversely proportional to the thickness of the photonic crystal fiber cladding.