A semiconductor device, comprising: a semiconductor substrate of a first conductivity type; and a vertical Hall element formed on the semiconductor substrate, the vertical Hall element comprising: a semiconductor layer of a second conductivity type formed on the semiconductor substrate; a first electrode set formed in a surface of the semiconductor layer and including a first drive current supply electrode (31 1), a Hall voltage output electrode, and a second drive current supply electrode (31 2) aligned along a straight line extending in a first direction in this order; second to fifth electrode sets (ES2-ES5) each having the same configuration as the configuration of the first electrode set and aligned with the first electrode set along a straight line extending in a second direction perpendicular to the first direction; and four electrode isolation diffusion layers of the first conductivity type formed in the surface of the semiconductor layer and each configured to isolate adjacent electrode sets of the first to fifth electrode sets from each other, the Hall voltage output electrode having a first depth, characterized in that each of the first drive current supply electrode and the second drive current supply electrode has a second depth that is larger than the first depth and the depth of the four electrode isolation diffusion layers. a semiconductor substrate of a first conductivity type; and a vertical Hall element formed on the semiconductor substrate, the vertical Hall element comprising: a semiconductor layer of a second conductivity type formed on the semiconductor substrate; a first electrode set formed in a surface of the semiconductor layer and including a first drive current supply electrode (31 1), a Hall voltage output electrode, and a second drive current supply electrode (31 2) aligned along a straight line extending in a first direction in this order; second to fifth electrode sets (ES2-ES5) each having the same configuration as the configuration of the first electrode set and aligned with the first electrode set along a straight line extending in a second direction perpendicular to the first direction; and four electrode isolation diffusion layers of the first conductivity type formed in the surface of the semiconductor layer and each configured to isolate adjacent electrode sets of the first to fifth electrode sets from each other, a semiconductor layer of a second conductivity type formed on the semiconductor substrate; a first electrode set formed in a surface of the semiconductor layer and including a first drive current supply electrode (31 1), a Hall voltage output electrode, and a second drive current supply electrode (31 2) aligned along a straight line extending in a first direction in this order; second to fifth electrode sets (ES2-ES5) each having the same configuration as the configuration of the first electrode set and aligned with the first electrode set along a straight line extending in a second direction perpendicular to the first direction; and four electrode isolation diffusion layers of the first conductivity type formed in the surface of the semiconductor layer and each configured to isolate adjacent electrode sets of the first to fifth electrode sets from each other, the Hall voltage output electrode having a first depth, characterized in that each of the first drive current supply electrode and the second drive current supply electrode has a second depth that is larger than the first depth and the depth of the four electrode isolation diffusion layers.