How to get website collection programmatically in Magento 2?

Magento 2 is robust, scalable and strong functional e-commerce software used for online shopping store. Its support Multi website, multi-language,multi-store view for an online store. Many times in custom functionality for Multi website store need to get a collection of all the website information. In this case below code is useful.

Here We will go for how to get all website collection of the system by programmatically.

Create Block file,

Call from template file,

To get all the data output look like,