Yes, you can use a 529 plan to pay off student loans. The SECURE Act, which became law on December 20, 2019, allows families to use a 529 plan to pay student loans. You can take a qualified distribution to repay up to $10,000 in student loans owed by each of the beneficiary and the beneficiary's siblings.
However, you should check whether your state considers student loans as a qualifying expense. Just because the federal government has expanded the definition of qualifying educational expenses to include student loans, doesn't mean your state has.

.studentloans .saving .debt