  The accelerating behavior of cosmic fluid opposes to the gravitational
attraction, at present epoch, whereas standard gravity is dominant at small
scales. As a consequence, there exists a \emph{point} where the effects are
counterbalanced, dubbed \emph{turnaround radius}, $r_{\text{ta}}$. By
construction, it provides a bound on maximum structure sizes of the observed
universe. Once an upper bound on $r_{\text{ta}}$ is provided, i.e.
$R_{\text{TA,max}}$, one can check whether cosmological models guarantee
structure formation. Here, we focus on $f(R)$ gravity, without imposing \emph{a
priori} the form of $f(R)$. We thus provide an analytic expression for the
turnaround radius in the framework of $f(R)$ models. To figure this out, we
compute the turnaround radius in two distinct cases: 1) under the hypothesis of
static and spherically symmetric space-time, and 2) by using the cosmological
perturbation theory. We thus find a criterion to enable large scale structures
to be stable in $f(R)$ models, circumscribing the class of $f(R)$ theories as
suitable alternative to dark energy. In particular, we get that for constant
curvature, the viability condition becomes $R_{\text{dS}}f'(R_{\text{dS}}) \leq
5.48 \Lambda \Rightarrow f'(R_{\text{dS}}) \leq 1.37$, with $\Lambda$ and
$R_{\text{dS}}$ respectively the observed cosmological constant and the Ricci
curvature. This prescription rules out models which do not pass the
aforementioned $R_{\text{TA,max}}$ limit.
