The seismic performance of unreinforced masonry buildings is commonly assessed using equivalent frame modelling. Its computational efficiency allows for a large number of analyses to be conducted, which are often required to account for epistemic and aleatoric uncertainties. To obtain a full description of the building response, in-plane and out-of-plane failure modes need to be considered, though previous elements for equivalent frame models of unreinforced masonry buildings only account for the in-plane response. This paper presents the formulation of a three-dimensional macroelement for modelling the dynamic in-plane and out-of-plane behaviour of masonry panels, which extends the approach of a previously developed macroelement to simulate the in-plane response. The proposed three-node, three-dimensional macroelement is implemented in the software OpenSees and describes the main features of the in-plane and out-of-plane behaviour of a masonry wall, including second-order geometrical effects and a coupled shear/flexural response. It also allows for the use of complex material models. The proposed element is used to simulate experimental results for in-plane shear-compression tests and out-of-plane free vibration tests of masonry panels. The implemented element, as well as the example models, is openly shared through the repository https://github.com/ eesd-epfl/OpenSees/wiki. K E Y W O R D S 3D macroelement, equivalent frame modelling, masonry, out-of-plane response, seismic analysis 1 | INTRODUCTION Unreinforced masonry buildings are among the most vulnerable under earthquake loading, and as such, are responsible for much of the economic and social impact of a seismic event. Because their seismic behaviour is heavily influenced by nonlinear phenomena, such as cracking or crushing, that is already apparent at moderate deformation levels, it is common to conduct nonlinear seismic analyses when assessing or even designing such buildings. To assist in this regard, several approaches have been proposed in the literature for modelling structural masonry, varying in the level of detail. In detailed micromodelling approaches, 1 the heterogeneity of the material is treated explicitly, whereas in simplified micromodels, joints are modelled by interface elements. 2,3 Less computationally expensive models include homogenised micromodels 4-6 and models in which damage is smeared into a continuum. 7-9 As an alternative to finite element modelling, discrete elements have been used for blocky structures, 10,11 accounting for the complex dynamics of interacting blocks. Although such modelling approaches comprise different levels of complexity and are, as a result,