usability – How to present the filter elements in a sidebar?

I have a site where I have to present filter elements in a sidebar. These elements act as "filters" for the content of the site on the right. The user can enable or disable these filters (the selected items are highlighted) and the content on the right is populated based on these selections. The problem is that there may be even 40 to 50 of these items in this view in several different groups and that the user must be able to see them all. How can I represent these elements in a clear and understandable way?

enter the description of the image here

The image is a sketch of the current situation in which the elements are located. Each element is associated with a recognizable icon, which helps to identify which filter means what. Can items be displayed only as icons to save space, or is it a bad model? There is not much space in the sidebar as we must also include other tools (settings, etc.), which aggravates the problem.