A microfluidic device comprising: a magnetophoresis region; an inertial focusing region upstream of the magnetophoresis region; and a microfluidic channel in the magnetophoresis region, wherein the magnetophoresis region comprises a first array of magnets arranged on top of the microfluidic channel, a second array of magnets arranged below the microfluidic channel, wherein each magnet in the first array has a magnetic pole orientation that is opposite to a magnetic pole orientation of an adjacent magnet in the first array, wherein each magnet in the second array has a magnetic pole orientation that is opposite to a magnetic pole orientation of an adjacent magnet in the second array, wherein each magnet in the first array has a magnetic pole orientation that is opposite to a magnetic pole orientation of a corresponding magnet in the second array, wherein the magnets in each array (202, 204) are arranged so that adjacent magnets are in direct contact, and wherein an interface between two directly contacting magnets in the first array is aligned with an interface between two directly contacting magnets in the second array, wherein the first array and the second array produce a magnetic flux gradient profile that extends transverse to a central longitudinal axis of the microfluidic channel, wherein the magnetic flux gradient profile comprises a local minimum positioned within the channel and at least 50 microns away from walls of the microfluidic channel due to the alignment of the first and second magnet arrays with respect to one another, wherein the inertial focusing region is configured to localize fluid particles of a fluid sample along a common streamline, wherein the common streamline is positioned to within a margin of +/- 10% around the position of the local minimum in the absolute value of the magnetic flux gradient profile within the microfluidic channel, and wherein the absolute value of the magnetic flux gradient profile comprises a first maximum and a second maximum that bound the local minimum in the magnetic flux gradient profile. a magnetophoresis region; an inertial focusing region upstream of the magnetophoresis region; and a microfluidic channel in the magnetophoresis region, wherein the magnetophoresis region comprises a first array of magnets arranged on top of the microfluidic channel, a second array of magnets arranged below the microfluidic channel, wherein each magnet in the first array has a magnetic pole orientation that is opposite to a magnetic pole orientation of an adjacent magnet in the first array, wherein each magnet in the second array has a magnetic pole orientation that is opposite to a magnetic pole orientation of an adjacent magnet in the second array, wherein each magnet in the first array has a magnetic pole orientation that is opposite to a magnetic pole orientation of a corresponding magnet in the second array, wherein the magnets in each array (202, 204) are arranged so that adjacent magnets are in direct contact, and wherein an interface between two directly contacting magnets in the first array is aligned with an interface between two directly contacting magnets in the second array, wherein the first array and the second array produce a magnetic flux gradient profile that extends transverse to a central longitudinal axis of the microfluidic channel, wherein the magnetic flux gradient profile comprises a local minimum positioned within the channel and at least 50 microns away from walls of the microfluidic channel due to the alignment of the first and second magnet arrays with respect to one another, wherein the inertial focusing region is configured to localize fluid particles of a fluid sample along a common streamline, wherein the common streamline is positioned to within a margin of +/- 10% around the position of the local minimum in the absolute value of the magnetic flux gradient profile within the microfluidic channel, and wherein the absolute value of the magnetic flux gradient profile comprises a first maximum and a second maximum that bound the local minimum in the magnetic flux gradient profile.