Using smartphones to explore the physical laws of musical instruments is not only scientifically intriguing but also practically feasible. Here an experimental scheme based on a smartphone and mobile application (Phyphox) is devised to investigate the vibration law of guitar strings. By quantitatively measuring the length, diameter and vibration frequency of guitar strings, the experimental results convincingly demonstrate the validity of the vibration law of guitar strings. The research embodies the concept of ‘from life to physics, from physics to society’, and is beneficial for students to comprehend the physical laws of guitar string vibration as well as the principle behind guitar sounds. The smartphone-based physics experiments can be performed outside the classic physics laboratory, which expands the methods and space of teaching physics experiments, and relates reality to physics laws.