How to get the base URL in Magento 2?

For getting the base URL, please use the below code:How to get base URL in Magento 2?

How to get base URL in Magento 2?expoundsofttechsolution

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$storeManager->getStore()->getBaseUrl();