Magento 2 : How to get CMS page page_id from url ?

Magento 2 stores the URL identifier in url_rewrite table. You can get the page entity_id or page_id by idendifier. If you look into url_rewrite table where you can search by request_path column.

url_rewrite table

Programmatically you can use the following Model Class.

/<Magento Root Directory>/vendor/magento/module-cms/Model/Page.php

It will return 2 which is the default page id for home page.