You can either change your online ID on your PS4 or web browser. It does not work with PS3 or Vita. That, and the ID change won't be supported on PlayStation 3 or PS Vita games, or titles that were initially launched before 2018 and then later remastered.
Select "PSN Profile" in the menu to the left, and then click on the "Edit" button next to your Online ID.
To change your PSN ID, you must either use a PS4 or your computer. The first change is free, with subsequent changes costing $9.99 a pop (but PS Plus members get a 50% discount).
PSN users can change their Online ID as many times as they like and if they run into any issues after that can revert back to their old ID.
However, the company claims that that reverting back to your old ID should resolve most issues that arise.
Previous online ID (s) may remain visible to you and other players, or the online ID is no longer visible in some areas in a game title (in-game rankings, leaderboards, etc).
Loss of UGC or parts of the game may not function properly, both online and offline. Games published on or after April 1, 2018 should support this new change, but Sony has not tested all of the games to be sure, according to the blog post.
Here's a list of things you'll probably need or want to know.
All PS4 games published since April 1, 2018, have been developed to support the name change feature, but PlayStation can not guarantee they will all work, as they have not been tested. "However, since they have not all been specifically tested with the feature, we can not guarantee that they will support it". If you have a child, Sony stated child accounts can not change their online ID.
For example: a game released in 2015 has been re-mastered or re-sold as a complete edition in 2018 will not support the ID change feature.
From this screen, you can either enter a PSN username of your choice, or select a custom one from the list of suggestions generated. But you can enable this feature only at the time of the name change. PlayStation admits "we expect major issues to occur only in a small number of games". The issues relate to game progress, in-game currency, and achievements earned.
Q: What should I do if I encounter an issue by changing my online ID?