  For layered materials, the interlayer stacking is a critical degree of
freedom tuning electronic properties, while its microscopic characterization
faces great challenges. The transition-metal dichalcogenide 1T-TaS$_2$
represents a novel example, in which the stacking pattern is not only enriched
by the spontaneous occurrence of the intralayer charge density wave, but also
recognized as a key to understand the nature of the low-temperature insulating
phase. We exploit the $^{33}\rm{S}$ nuclei in a 1T-TaS$_2$ single crystal as
sensitive probes of the local stacking pattern via quadrupolar coupling to the
electron density distribution nearby, by combining nuclear magnetic resonance
(NMR) measurements with the state-of-the-art first-principles electric-field
gradient calculations. The applicability of our proposal is analyzed through
temperature, magnetic-field, and angle dependent NMR spectra. Systematic
simulations of a single 1T-TaS$_2$ layer, bilayers with different stacking
patterns, and typical stacking orders in three-dimensional (3D) structures
unravel distinct NMR characteristics. Particularly, one 3D structure achieves a
quantitative agreement with the experimental spectrum, which clearly
rationalizes the coexistence of two types of interfacial environments. Our
method may find general applications in the studies of layered materials.
