Abstract We performed a statistical study of magnetic activities of M-type stars by combining the spectra of LAMOST DR5 with light curves from the Kepler and K2 missions. We mainly want to study the relationship between chromospheric activity and flares, and their relations of magnetic activity and rotation period. We have obtained the maximum catalog of 516,688 M-type stellar spectra of 480,912 M stars from LAMOST DR5 and calculated their equivalent widths of chromospheric activity indicators (Hα, Hβ, Hγ, Hδ, Ca ii H&K, and He i D3). Using the Hα indicator, 40,464 spectra of 38,417 M stars show chromospheric activity, and 1791 of these 5499 M-type stars with repeated observations have Hα variability. We used an automatic detection plus visual inspection method to detect 17,432 flares on 8964 M-type stars from the catalog by cross-matching LAMOST DR5 and the Kepler and K2 databases. We used the Lomb–Scargle method to calculate their rotation periods. We find that the flare frequency is consistent with the ratio of activities of these chromospheric activity indicators as a function of spectral type in M0–M3. We find the equivalent widths of Hα and Ca ii H have a significant statistical correlation with the flare amplitude in M-type stars. We confirm that the stellar flare is affected by both the stellar magnetic activity and the rotation period. Finally, using the Hα equivalent width equal to 0.75 Å and using the rotation period equal to 10 days as the threshold for the M-type stellar flare time frequency are almost equivalent.