We present a formulation of the compositeness for baryonic resonances in order to discuss the meson-baryon molecular structure inside the resonances. For this purpose, we derive a relation between the residue of the scattering amplitude at the resonance pole position and the two-body wave function of the resonance in a sophisticated way, and we define the compositeness as the norm of the two-body wave functions. As applications, we investigate the compositeness of the \(\Delta (1232)\), \(N (1535)\), and \(N (1650)\) resonances from precise \(\pi N\) scattering amplitudes in a unitarized chiral framework with the interaction up to the next-to-leading order in chiral perturbation theory. The \(\pi N\) compositeness for the \(\Delta (1232)\) resonance is evaluated in the \(\pi N\) single-channel scattering, and we find that the \(\pi N\) component inside \(\Delta (1232)\) in the present framework is nonnegligible, which supports the previous work. On the other hand, the compositeness for the \(N (1535)\) and \(N (1650)\) resonances is evaluated in a coupled-channels approach, resulting that the \(\pi N\), \(\eta N\), \(K \Lambda\) and \(K \Sigma\) components are negligible for these resonances.