In this paper, an attempt is made to find the optimal form of the mass matrix of a rod finite element, which allows one to obtain the smallest errors in the longitudinal frequency determination of natural vibrations of any boundary conditions within the whole range of determined frequencies. It is assumed that the mass matrix can be treated as a linear combination of the consistent and diagonal matrices. Based on analytical considerations, the optimal values of certain weights for creating a linear combination of the mentioned matrices have been determined. As a result, a mass matrix has been obtained which allows the determination of natural frequencies with the smallest mean error within the possible spectrum of frequencies. It is also shown that the value of the weight coefficient changes depending on the number of natural frequencies within the spectrum one wants to determine. • Determination of the optimal form of a rod finite element mass matrix in the context of minimal errors in calculation of natural frequencies for longitudinal vibration. • Calculation of certain values of weights in order to determine the natural frequencies with the smallest mean error in the range of analysed frequencies. • Determination of optimal values of weight factors.