This paper presents the design and implementation of optimal and robust state feedback controller for rotary inverted pendulum system. The Particle Swarm Optimization (PSO) method is used to find the optimal values of the state feedback gains subject to time response specifications and H_∞ constraints. To improve the tracking of the system, a robust state feedback plus integral controller is designed. The simulation results show that the proposed controller can effectively stabilize the pendulum at the upright position. Further, the proposed controller can compensate the variations in system parameters. The effectiveness of the proposed controller is verified experimentally using real rotary inverted pendulum.