You can find this through the User Interface or using the API via tools like Workbench.
Please navigate to the "System Overview" setup section ( https://instance.salesforce.com/setup/systemOverview.apexp?setupid=SystemOverview ) and check the "Portal Roles" section.
Note: The Portal Roles box in the system overview page shows the usage data and limit for total partner portal, Customer Portal, and Communities roles. Also, please note that the Roles in the Territory Hierarchy (partner, Customer Portal and Communities roles) count towards this limit.
Open Workbench. Click on "Info" and select "Metadata Types & Components". Then you can select "Role" as metadata type. The number of roles will display in the "Components" folder.
Note: The Workbench shows also the number of Roles in the Role Hierarchy.
More information about the Role metadata type: Metadata Types
The Portal Roles count can also be found using SOQL if necessary. Please use the following queries and add the results together to get the total count.
SELECT Count() FROM UserRole where PortalAccountId != Null SELECT Count() FROM UserRole where PortalAccountOwnerId != Null
More information about the System Overview: About the System Overview Page
000387020

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.