Shear design of RC beams with and without stirrups using laboratory experiments is difficult or even impossible as a large number of variables need to be considered simultaneously, such as the span-to-depth ratio, web width and reinforcement ratio. In addition, due to the complex shear failure mechanism, empirical approaches for shear design are derived within the boundaries of their own testing regimes. Thus, the generalization ability and applicability of these approaches are limited. To address this issue, this study uses machine learning approaches for shear design. A random forest model is constructed to predict the shear strength of RC beams. The hyperparameters of RF are tuned using beetle antennae search algorithm modified by Levy flight and inertia weight. The developed model is trained on two data sets of RC beams with and without stirrups containing 194 and 1849 samples, respectively. The obtained model has high prediction accuracy with correlation coefficients of 0.9367 and 0.9424 on these two test data sets, respectively. The proposed method is powerful and efficient in shear design of RC beams with and without stirrups and therefore paves the way to intelligent construction.