A controller of an electrically powered vehicle, the controller being installed in the electrically powered vehicle including a motor for traveling, an inverter that drives the motor, and an electricity storage device that exchanges electricity with the motor through the inverter, the controller comprising an electronic control unit configured to perform switching control on a switching element (T11, T12, T13, T14, T15, T16) of the inverter by switching between pulse-width modulation control and square wave control according to a modulation percentage, wherein the electronic control unit is configured to perform the switching control by the square wave control in a first switching mode when a rotation speed of the motor is equal to or higher than a first predetermined rotation speed, the electronic control unit is configured to perform the switching control by the square wave control in a second switching mode when the rotation speed of the motor is lower than the first predetermined rotation speed, the first predetermined rotation speed is lower than a resonance rotation speed in a first resonance region, the first switching mode is a mode of a switching pattern configured to suppress LC resonance in the first resonance region, the second switching mode is a mode of a switching pattern configured to suppress LC resonance in a second resonance region lower than the first predetermined rotation speed, the first switching mode is a mode of a switching pattern having three or more pulses per cycle, with a first half cycle and a latter half cycle of each cycle having one or more pulses and the first half cycle and the latter half cycle of each cycle having the same number of periods during which voltage polarity is temporarily reversed, and the second switching mode is a mode of a switching pattern having a greater number of pulses than the first switching mode. the electronic control unit is configured to perform the switching control by the square wave control in a first switching mode when a rotation speed of the motor is equal to or higher than a first predetermined rotation speed, the electronic control unit is configured to perform the switching control by the square wave control in a second switching mode when the rotation speed of the motor is lower than the first predetermined rotation speed, the first predetermined rotation speed is lower than a resonance rotation speed in a first resonance region, the first switching mode is a mode of a switching pattern configured to suppress LC resonance in the first resonance region, the second switching mode is a mode of a switching pattern configured to suppress LC resonance in a second resonance region lower than the first predetermined rotation speed, the first switching mode is a mode of a switching pattern having three or more pulses per cycle, with a first half cycle and a latter half cycle of each cycle having one or more pulses and the first half cycle and the latter half cycle of each cycle having the same number of periods during which voltage polarity is temporarily reversed, and the second switching mode is a mode of a switching pattern having a greater number of pulses than the first switching mode.