The Code of Canon Law recognizes that, “a valid matrimonial contract cannot exist between the baptized without it being by that fact a sacrament” (CIC 1055 §2). So there are two requirements for a marriage to be a sacramental marriage: (1) the marriage must be valid; and (2) both parties must be baptized.
To be in a valid marriage, Catholics must meet certain requirements of canon law including the obligation to observe the Church’s form of marriage celebration or to be dispensed from that form. This applies to every Catholic, even when marrying a non-Catholic.
All valid marriages between Catholics are sacramental because you can’t be Catholic without being baptized. However, a valid marriage between a Catholic and a baptized non-Catholic is sacramental, while a valid marriage between a Catholic and a non-baptized person is not.
Non-Catholics are not generally under the authority of canon law concerning marriage, so marriages between non-Catholics are generally recognized to be valid unless proven otherwise. Some of these marriages are sacramental (when both parties are baptized) and some are not (when one or both are not baptized).