Block IP address from viewing website - help

Is there some type of code which will block an ip address from viewing your website?
(Not on the same intranet, but another ISP)

or

Through the web host “CPANEL” are their any options for blocking specific IP address’ from viewing your website?