A geodesic is a shortest path which connects a pair of vertices of a graph G. In this paper, we define the geodesic subpath number \(\textrm{gpn}(G)\) of a graph G as the number of geodesics in G. The number of subtrees and subpaths are already studied in the literature, but they are both large quantities. Hence, the geodesic subpath number which is related to these quantities but smaller than both seems worthy of investigation. We first consider extremal graphs with respect to the geodesic subpath number among all connected graphs on n vertices. This number is minimized by the so-called geodetic graphs, i.e., graphs in which each pair of vertices is connected by precisely one geodesic. As for the graphs which maximize the geodesic subpath number, we provide an upper bound on \(\textrm{gpn}(G)\) in terms of n and we further consider several graph families which might have a large \(\textrm{gpn}(G)\) . Yet, their value of \(\textrm{gpn}(G)\) still does not attain the established bound, so narrowing the gap remains as an open problem. We also consider the class of cactus graphs on n vertices and k cycles and among them characterize extremal graphs with respect to this new invariant.