Essentially, this article is written to present and analyse the analytical and numerical solutions of the Kadomtsev–Petviashvili (KP) equation arising in plasma physics. We derive the basic set of fluid equations governing the KP equation. The analytical solution, presented on forms of rational functions, hyperbolic functions and trigonometric functions, was analytically investigated while the numerical solution is examined here by utilizing the adaptive moving mesh method on finite differences. The stability of the obtained exact solutions is also presented and analysed. All solutions are found stable on specific intervals. The exact and numerical solutions are compared with each other to show the accuracy of the numerical solution. Under an appropriate choice of parameters, some 2D and 3D figures for the obtained analytical and numerical results are illustrated in order to compare between their accuracy.