Flexoelectric effect is a universal and size-dependent electromechanical coupling between the strain gradient and electric field. The mathematical framework for flexoelectricity, which involves higher-order gradients of field quantities, is difficult to handle using traditional finite element method (FEM). Thus, it is important to develop an effective numerical method for flexoelectricity. In this paper, we develop a three-dimensional (3D) mixed finite element considering both flexoelectricity and strain gradient elasticity. To validate the developed element, we simulate the electromechanical behavior of a flexoelectric spherical shell subjected to inner pressure and compare the numerical results to analytical results. Their excellent agreement shows the reliability of the proposed FEM. The developed finite element is also used to simulate the electromechanical behavior of a nanometer-sized flexoelectric truncated pyramid. By decreasing the sample size, we observed the increase of its effective piezoelectricity. However, due to the effects of strain gradient elasticity and the influence of flexoelectricity on stiffness, the dependency of effective piezoelectricity on the sample size is not trivial. Numerical results indicate that, when the sample size is smaller than a certain value, the increase of effective piezoelectricity slows down. This finding also shows the importance of a numerical tool for the study of flexoelectric problems.