At the blacksmith, you can move an item from the inventory to the "Socket upgrade" field to add a socket for a gem. This is possible for all items except warrior shields. Items to which a gem socket can be added are highlighted in your inventory.

Add Gem Socket

If there is an item in the backpack, the socket upgrade also works via the context menu which can be accessed by right-clicking the item.

The resource costs for a socket are based on the quality of the item. Therefore, it is recommended to add a socket before an item is improved via "Attribute upgrade".

A socket upgrade costs metal and arcane splinters.

When dragging a gem on an item without gem socket an option will open to add gem and socket in one single step.