Renewable energy is being increasingly integrated into distribution systems worldwide in response to technological, economic, and environmental challenges. The assessment of hosting capacity allows us to determine the maximum installation capacity of distributed energy resources (DERs) in a distribution system within its operational limits to obtain more benefits. In this study, a new multistage algorithm is developed based on an analytical approach and optimal power flow (OPF) for the assessment of DERs' hosting capacity (DERHC) with single and multiple multi-type DERs. In the first stage, the optimal locations of DERs are determined analytically, and the second stage involves the calculation of optimal DERs sizes for the assessment of the maximum locational and total DERHC. This method provides mathematical and global optimum certainty considering the constraints to maintain the reliability and protection of the system. Moreover, the proposed method is tested using a standard IEEE 33-bus distribution system, and different scenarios are created based on the number and type of DERs to achieve the best-case results of DERHC. The obtained results are compared with those of the conventional OPF iterative method that are encouraging and validate the accuracy and robustness of the proposed methodology.INDEX TERMS Analytical optimal power flow method, hosting capacity assessment, multi-type distributed generation, optimal power flow.