Can I use pagespeed insights for my local host website or offline?

Yes.

Use the "Lighthouse" tab from your google chrome dev tools.

This is a great starter tutorial on how to do that: https://www.youtube.com/watch?v=5fLW5Q5ODiE

Edit: user izogfif pointed out the "Audit" tab was replaced by "Lighthouse".


An alternative way to run Lighthouse

Although this is an old question there is an alternative way to run Lighthouse (the engine behind Page Speed Insights) locally that may be useful to people in some circumstances.

You can install the Lighthouse Command Line Interface (CLI) locally on your machine quite easily.

This gives you some significant advantages over using the "Lighthouse" tab in Developer tools.

Automation

Firstly you can automate it. You could have it run on every significant change / commit to check you haven't broken something.

Or if you want to check every page on your website you can automate that, very useful if you have hundreds of pages.

Storing results

Secondly you get the full JSON response (or CSV or HTML report, your choice) so you can store some (or all) of the audit results to a database for each page and see if any pages are performing poorly or whether you are improving or ruining your page performance.

Customisation

You can also set your own parameters when running tests.

For example I like to set my "cpuSlowdownMultiplier" very high (8 or 10) as I have a decent CPU and I want to catch any bottlenecks / long tasks that I may miss on slower devices. This is great for making you realise how sloppy your (my!) JavaScript is!

You can also pass headers, set cookies (slightly difficult at the moment but something they are working on) etc. before a run.

You can even use --disable-storage-reset to see how the site responds on a subsequent page visit where the user has already cached images etc. (you can do this in the Lighthouse tab in Developer tools so maybe not that good a reason).

Because you get the raw timings data you can also set your own criteria if you want.

Puppeteer

The icing on the cake is that you can use puppeteer (or similar) to automate complex tasks.

Lets say you want to check a page that is only accessible when you have logged in, use puppeteer to log in and then run lighthouse.

So which should I use?

I would advocate for the CLI if you are going to test regularly / want to automate testing, the Developer tools version for quick and dirty checks / infrequent testing.

Personally it took me about an hour to install and get used to Lighthouse, but I also had to install and learn how to use nodeJS (npm) command line to install lighthouse into my project (yes I am a slow learner!).

If I didn't have to learn that, probably 5 minutes to install and run your first test.

It is actually really simple to use the CLI once you have it installed.

Only down side is you need to update every few months, which is automatic in the browser. However even then that is a positive to me as if you are comparing over time using an older version might be useful.

Oh and you can run it on remote sites as well, so you can test the production site automatically from your own machine (useful if you are located a long way from the PSI server and want an idea of how your site performs in your local community).

This is also really useful if you have a staging server that only allows whitelisted IP addresses and want to test on there (yet again can be done with Developer tools Lighthouse but useful for bulk testing etc.)