Mobile inverted pendulums are needed to be stabilized at all times using a safe control method. Previous approaches were based on a linearized model or feedback linearization. In this study, interconnection and damping assignment passivity-based control (IDA-PBC) is applied. The IDA-PBC is a nonlinear control method which has been shown to be powerful to stabilize underactuated mechanical systems. Although partial differential equations (PDEs) must be solved to derive the IDA-PBC controller and it is a difficult task in general, we show that the controller for the mobile inverted pendulum can be constructed. A systematic graphical method to select controller parameters that guarantee asymptotic stability and a procedure to estimate the domain of attraction are also proposed. Using this method, the pendulum is stabilized by restricting it to a predefined angle range. Simulation results show that the IDA-PBC controller performs fast responses theoretically ensuring sufficient domain of attraction. The effectiveness of the IDA-PBC controller is also verified in experiments. Especially control performance under an impulsive disturbance on the mobile inverted pendulum is verified. The IDA-PBC achieves as fast transient performance as a linear-quadratic regulator (LQR). In addition, we show that when the pendulum inclines quickly and largely due to the disturbance, the IDA-PBC controller can stabilize it whereas the LQR cannot.