A corotational finite element formulation for two-dimensional beam elements with geometrically nonlinear behavior is presented. The formulation separates the rigid body motion from the pure deformation which is always small relative to the corotational element frame. The stiffness matrices and the mass matrices are evaluated using both Euler-Bernoulli and Timoshenko beam models to reveal the shear effect in thin and thick beams and frames. The nonlinear equilibrium equations are developed using Hamilton’s principle and are defined in the global coordinate system. A MATLAB code is developed for the numerical solution. In static analysis, the code employed an iterative method based on the full Newton-Raphson method without incremental loading, while, in dynamic analysis, the Newmark direct integration implicit method is also utilized. Several examples of flexible beams and frames with large displacements are presented. Not only is the method simple and time-saving, but it is also highly effective and highly accurate.