In the present paper, a modification of hat functions (MHFs) has been considered for solving a class of nonlinear fractional integro-differential equations with weakly singular kernels, numerically. The fractional order operational matrix of integration is introduced. We provide an error estimation for the approximation of a function by a series of MHFs. To suggest a numerical method, the main problem is converted to an equivalent Volterra integral equation of the second kind and operational matrices of MHFs are used to reduce the problem to the solution of bivariate polynomial equations. Finally, illustrative examples are provided to confirm the accuracy and validity of the proposed method.