In the present paper we establish the Wiener test for boundary regularity of the solutions to the polyharmonic operator. We introduce a new notion of polyharmonic capacity and demonstrate necessary and sufficient conditions on the capacity of the domain responsible for the regularity of a polyharmonic function near a boundary point. In the case of the Laplacian the test for regularity of a boundary point is the celebrated Wiener criterion of 1924. It was extended to the biharmonic case in dimension three by Mayboroda and Maz’ya (Invent Math 175(2):287–334, 2009). As a preliminary stage of this work, in Mayboroda and Maz’ya (Invent Math 196(1):168, 2014) we demonstrated boundedness of the appropriate derivatives of solutions to the polyharmonic problem in arbitrary domains, accompanied by sharp estimates on the Green function. The present work pioneers a new version of capacity and establishes the Wiener test in the full generality of the polyharmonic equation of arbitrary order. © 2017, Springer-Verlag GmbH Germany.