It has never been tested in court.
But historical the question came into spotlight when President Richard Nixon considered a self-pardon during the Watergate scandal. His legal team reportedly concluded that he could pardon himself, but the matter became moot when he resigned, and his successor, Gerald Ford, pardoned him instead. Also President Donald Trump faced questions about self-pardons, but no definitive action or legal challenge occurred.
I would say that while the Constitution does not explicitly prohibit a self-pardon, significant legal and ethical questions surround the issue on a case by case situation. Until a president attempts it and the courts rule on its validity, the matter remains uncertain. 🤷♀️