Here's an example of how it works.
A compound consists of
72.2% magnesium and 27.8% nitrogen
by mass. What is the empirical formula?