Abstract In this work we aim to narrow the gap between plan recognition and planning by exploiting the power and generality of recent planning algorithms for recognizing the set G∗ of goals G that explain a sequence of observations given a domain theory. After providing a crisp defifinition of this set, we show by means of a suitable problem transformation that a goal G belongs to G∗ if there is an action sequence π that is an optimal plan for both the goal G and the goal G extended with extra goals representing the observations. Exploiting this result, we show how the set G∗ can be computed exactly and approximately by minor modififications of existing optimal and suboptimal planning algorithms, and existing polynomial heuristics. Experiments over several domains show that the suboptimal planning algorithms and the polynomial heuristics provide good approximations of the optimal goal set G∗ while scaling up as well as state-of-the-art planning algorithms and heuristics