The deformation and detachment of bacterial biofilm are related to the structural and mechanical properties of the biofilm itself. Extracellular polymeric substances (EPS) play an important role on keeping the mechanical stability of biofilms. The understanding of biofilm mechanics and detachment can help to reveal biofilm survival mechanisms under fluid shear and provide insight about what flows might be needed to remove biofilm in a cleaning cycle or for a ship to remove biofilms. However, how the EPS may affect biofilm mechanics and its deformation in flow conditions remains elusive. To address this, a coupled computational fluid dynamic – discrete element method (CFD-DEM) model was developed. The mechanisms of biofilm detachment, such as erosion and sloughing have been revealed by imposing hydrodynamic fluid flow at different velocities and loading rates. The model, which also allows adjustment of the proportion of different functional group of microorganisms in the biofilm, enables the study of the contribution of EPS towards biofilm resistance to fluid shear stress. Furthermore, the stress-strain curves during biofilm deformation have been captured by loading and unloading fluid shear stress to study the viscoelastic properties of the biofilm.