Solar and stellar flares are explosive phenomena in which magnetic energy stored around starspots is suddenly released through magnetic reconnection. The radiation emitted during flares covers a broad range of wavelengths from radio to X-rays, each tracing different aspects of the flare process. In X-rays, the emission arises from hot thermal plasma heated by nonthermal electrons that travel upward from the chromosphere into the corona. RS CVn-type binaries and protostars exhibit giant flares that are several orders of magnitude more energetic than those on the Sun, and it remains unclear whether their underlying physical processes are fundamentally the same as in solar flares. Furthermore, the impact of high-energy radiation from flares on exoplanetary environments has recently attracted increasing attention. In particular, X-ray emission from protostars has recently drawn significant interest from the star and planet formation community in the context of X-ray–driven chemistry, as it may strongly affect the surrounding protoplanetary disks. Consequently, studies of protostellar flares have the potential to broaden the impact of X-ray astronomy into new fields such as planetary formation, where it has rarely ventured before. In this talk, I focus on the Fe K-shell emission lines, which are covered by many X-ray satellites, and introduce the physics of stellar flares that can be inferred from their line intensities and structures, based on observations with NICER and XRISM.