How to view website source code

Last Updated on 21 October 2020

Sometimes we might wonder of how other developers wrote the code. The way they write and structure the code. One of the best method is to check their website source code.

Method 1: Inspect Element (Keyboard Shortcut F12)

This is one of the most powerful and most common way to check the source code as a developer. With this method it allow you to change the HTML, CSS and JavaScript code with immediately effects.

Method 2: View Page Source (Keyboard Shortcut CTRL+U)

Unlike inspect element, view page source are only able to view the page source. You can’t change the code and see the change immediately.


As you can see from the image below. The source code can’t be edit. On the URL, it append with view-source: .

If you want to view source of website. You can add it before URL too as followings.


View Page Source