A magnetic sensor comprising: a magnetic material portion; an excitation portion applying an applied magnetic field (Be) changing on the basis of time to the magnetic material portion; and a magnetic detection portion (14, 50) detecting a magnetic field generated by the magnetic material portion, the magnetic sensor detecting a magnetic field by the magnetic detection portion detecting a detection magnetic field generated due to magnetic moments of the magnetic material portion changing between a state without application of the applied magnetic field and a state of being magnetized by the applied magnetic field, wherein the excitation portion is configured to include a conductive material formed into an elongated shape, the magnetic material portion is a soft magnetic film formed on a surface of the conductive material, wherein the magnetic moments of the magnetic material portion are oriented along circumferential directions of the conductive material orthogonal to a longitudinal direction of the conductive material such that the magnetic moments directed to one of the circumferential directions and the magnetic moments direction in another circumferential direction opposite to the one circumferential direction are distributed in substantially equal amounts, characterized in that the magnetic material portion is made up of a plurality of layers such that the magnetic moment in each of the layers is oriented in one direction orthogonal to the longitudinal direction of the conductive material or in a direction opposite to the one direction, the magnetic material portion includes at least one each of a first layer having the magnetic moment oriented in the one direction and a second layer having the magnetic moment oriented in the direction opposite to the one direction, and the first layer and the second layer are sequentially disposed. a magnetic material portion; an excitation portion applying an applied magnetic field (Be) changing on the basis of time to the magnetic material portion; and a magnetic detection portion (14, 50) detecting a magnetic field generated by the magnetic material portion, the magnetic sensor detecting a magnetic field by the magnetic detection portion detecting a detection magnetic field generated due to magnetic moments of the magnetic material portion changing between a state without application of the applied magnetic field and a state of being magnetized by the applied magnetic field, wherein the excitation portion is configured to include a conductive material formed into an elongated shape, the magnetic material portion is a soft magnetic film formed on a surface of the conductive material, wherein the magnetic moments of the magnetic material portion are oriented along circumferential directions of the conductive material orthogonal to a longitudinal direction of the conductive material such that the magnetic moments directed to one of the circumferential directions and the magnetic moments direction in another circumferential direction opposite to the one circumferential direction are distributed in substantially equal amounts, characterized in that the magnetic material portion is made up of a plurality of layers such that the magnetic moment in each of the layers is oriented in one direction orthogonal to the longitudinal direction of the conductive material or in a direction opposite to the one direction, the magnetic material portion includes at least one each of a first layer having the magnetic moment oriented in the one direction and a second layer having the magnetic moment oriented in the direction opposite to the one direction, and the first layer and the second layer are sequentially disposed.