AbstractAllowing structures to rock during an earthquake can effectively provide base isolation at a relatively small cost. Rocking limits the base shear demand and provides self‐centering, but the rocking response depends on energy dissipation caused by interaction with the soil and impacts during re‐centering. This paper addresses the computational modeling of buildings that have either been designed to rock on the soil beneath their foundation (foundation rocking) or at the foundation–structure interface (structural rocking). Within OpenSees, foundation and structural rocking were modeled using a beam‐on‐a‐nonlinear‐Winkler‐foundation model (BNWF) combined with flat‐slider elements for footing–soil and superstructure–footing interactions, respectively. The modified with flat‐slider elements BNWF model (mBNWF) involves an uplift‐dependent stiffness and viscous damping for both vertical and horizontal directions, and a friction–vertical force coupling. The proposed computational model was used to simulate an extensive set of centrifuge tests involving both structural rocking and foundation rocking with sequential excitations. Generally, the proposed modeling approach, without calibration of built‐in parameters, adequately captured the response observed in centrifuge experiments. More specifically, the modeling captured the response amplitude and waveform of story accelerations and building rocking angle in most cases, but including potential nonlinear behavior caused by previous ground excitations was in some cases critical to obtain reasonable predictions. This was more profound for foundation rocking due to its inherent dependency on the soil strength and energy dissipation; for structural rocking previous nonlinear response primarily affected the transition time between full contact and rocking, but had a smaller effect on the prediction of maximum response.