A semiconductor device includes a semiconductor layer that has a first surface and a second surface, a trench that is formed at the first surface of the semiconductor layer and that extends in a first direction, an element portion that has a first-conductivity-type first region, a second-conductivity-type second region, and a third-conductivity-type third region that are formed in order along a depth direction of the trench from the first surface of the semiconductor layer, a gate insulating film formed at an inner surface of the trench, and a gate electrode that is embedded in the trench and that faces the first region, the second region, and the third region through the gate insulating film.