Arachin 16b (translation Sefaria’s, emphasis mine):
מנין לרואה בחבירו דבר מגונה שחייב להוכיחו שנאמר (ויקרא יט, יז) הוכח תוכיח הוכיחו ולא קבל מנין שיחזור ויוכיחנו תלמוד לומר תוכיח מכל מקום יכול אפי' משתנים פניו ת"ל לא תשא עליו חטא
From where is it derived with regard to one who sees an unseemly matter in another that he is obligated to rebuke him? As it is stated: “You shall rebuke [hokhe’aḥ tokhiaḥ] your neighbor.” If one rebuked him for his action but he did not accept the rebuke, from where is it derived that he must rebuke him again? The verse states: “You shall rebuke [hokhe’aḥ tokhiaḥ],” and the double language indicates he must rebuke in any case. One might have thought that one should continue rebuking him even if his face changes due to humiliation. Therefore, the verse states: “Do not bear sin because of him”; the one giving rebuke may not sin by embarrassing the other person.
Menachos 37b (translation Sefaria’s, emphasis mine):
רבינא הוה קא אזיל אבתריה דמר בר רב אשי בשבתא דריגלא איפסיק קרנא דחוטיה ולא אמר ליה ולא מידי כד מטא לביתיה אמר ליה מהתם איפסיק א"ל אי אמרת לי מהתם שדיתיה
The Gemara relates: Ravina was walking behind Mar bar Rav Ashi on the Shabbat of the Festival when the corner of Mar bar Rav Ashi’s garment on which his ritual fringes were hanging tore, and yet Ravina did not say anything to him. When he arrived at Mar bar Rav Ashi’s house, Ravina said to him: Back there, along the way, the corner tore. Mar bar Rav Ashi said to him: If you would have told me then, I would have thrown off the garment there, as once one of the ritual fringes is torn no mitzva is performed with the rest, and it is prohibited to walk in the public domain on Shabbat wearing such a garment.
Rambam, Hilchos De’os 6:8 (translation Sefaria’s):
הַמּוֹכִיחַ אֶת חֲבֵרוֹ תְּחִלָּה לֹא יְדַבֵּר לוֹ קָשׁוֹת עַד שֶׁיַּכְלִימֶנּוּ שֶׁנֶּאֱמַר (ויקרא יט יז) "וְלֹא תִשָּׂא עָלָיו חֵטְא". כָּךְ אָמְרוּ חֲכָמִים יָכוֹל אַתָּה מוֹכִיחוֹ וּפָנָיו מִשְׁתַּנּוֹת תַּלְמוּד לוֹמַר וְלֹא תִשָּׂא עָלָיו חֵטְא. מִכָּאן שֶׁאָסוּר לָאָדָם לְהַכְלִים אֶת יִשְׂרָאֵל וְכָל שֶׁכֵּן בָּרַבִּים. אַף עַל פִּי שֶׁהַמַּכְלִים אֶת חֲבֵרוֹ אֵינוֹ לוֹקֶה עָלָיו עָוֹן גָּדוֹל הוּא. כָּךְ אָמְרוּ חֲכָמִים (גמרא סנהדרין קז א) "הַמַּלְבִּין פְּנֵי חֲבֵרוֹ בָּרַבִּים אֵין לוֹ חֵלֶק לָעוֹלָם הַבָּא". לְפִיכָךְ צָרִיךְ אָדָם לְהִזָּהֵר שֶׁלֹּא לְבַיֵּשׁ חֲבֵרוֹ בָּרַבִּים בֵּין קָטָן בֵּין גָּדוֹל. וְלֹא יִקְרָא לוֹ בְּשֵׁם שֶׁהוּא בּוֹשׁ מִמֶּנּוּ. וְלֹא יְסַפֵּר לְפָנָיו דָּבָר שֶׁהוּא בּוֹשׁ מִמֶּנּוּ. בַּמֶּה דְּבָרִים אֲמוּרִים בִּדְבָרִים שֶׁבֵּין אָדָם לַחֲבֵרוֹ. אֲבָל בְּדִבְרֵי שָׁמַיִם אִם לֹא חָזַר בּוֹ בַּסֵּתֶר מַכְלִימִין אוֹתוֹ בָּרַבִּים וּמְפַרְסְמִים חֶטְאוֹ וּמְחָרְפִים אוֹתוֹ בְּפָנָיו וּמְבַזִּין וּמְקַלְּלִין אוֹתוֹ עַד שֶׁיַּחֲזֹר לַמּוּטָב כְּמוֹ שֶׁעָשׂוּ כָּל הַנְּבִיאִים בְּיִשְׂרָאֵל:
He who rebukes a friend, at the beginning, no hard words should be used against him to shame him, for it is said: "And thou shalt bear no sin upon him" (Lev. 19.17). Thus did the wise men say: "Understand it not by rebuking him thou mayest cause his countenance to change expression; for, it is said: 'And thou shalt bear no sin upon him'" (Ibid.; Arakin, 16b); herefrom we learn that it is forbidden to put an Israelite to shame, needless to say publicly. Although he who does put his fellow to shame is not flogged, it is a grievous sin. Even so did the wise men say: "He who publicly puts his fellow's countenance to shame has no share in the world to come" (Pirke Abot, 3.15). A man is, therefore obliged to guard himself against putting his fellow to shame publicly, regardless of whether he be young or old; not to call him by a name of which he feels ashamed, nor tell aught in his presence of which he is ashamed. However, all these refer to matters touching the relationship between man and man; but if it concern heavenly matters, if the sinner does not repent after being rebuked privately, he should be shamed publicly, and his sin should be proclaimed, and harsh words should be used in his presence, and he should be shamed and cursed till he repent and take up the good path, even as all of the prophets in Israel did with the wicked.8Baba Mezi’a 59a; Yoma, 86b. C. G.