How to blacklist all domains (then whitelist a few)(Want to use for website blocking)

I want to blacklist all domains then only allow a few websites. Is there a way to do this??

That is not supported with Pi-hole really, but you could make a custom dnsmasq config.