On desktop computers, open the YouTube app and click on “Settings” then “Safety” to select either Restricted or Safety mode; on mobile devices, tap the account icon in the top right corner of the screen, then tap “Settings” followed by “Restricted Mode & Safety Filter” to choose either setting.