We model anisotropic compact stars by solving Einstein field equation with a generalized form of equation of state (EoS) and a physically reasonable metric potential $$g_{rr}$$ which allows us to extract models with various type of EoSs such as linear, quadratic, polytrope, Chaplygin and Color-flavor-locked. The generated interior metrics match smoothly with the exterior Schwarzschild metric. The radius $$R = 8.301$$ km and mass $$M=1.0359M_{\odot }$$ of the strange star candidate SMC X-1 has been used as reference to check the physical validity of the generated models. The physical quantities emanating from the analysis for all generated models are regular and well behaved throughout the interior of the star and satisfy the necessary criterion of a realistic anisotropic star. The significance of EoSs in modeling a realistic star with regard to its gross physical behavior has been illustrated by graphical analysis. A complete physical analysis has been performed for the main physical observables, such as the density $$\rho $$ , the radial and tangential pressures as well as the anisotropy factor. Moreover, the stability of the star has been checked by means of the velocities of the pressure waves and the relativistic adiabatic index. The generated models satisfy the Bondi’s stability condition and Tolman–Oppenheimer–Volkoff equation for static equilibrium for all type of EoSs. The effect of anisotropy on cracking condition has been discussed.