Although web browsers interpret the Hypertext Markup Language files and Cascading Style Sheets that make the web appear as it does, a keyboard shortcut or URL modification forces browsers to display the source code of that page in a new tab or window. Although most people rarely need to examine the source code, developers use this perspective to resolve layout inconsistencies or fix bugs in a website.
How to View Website Source Codes
For all major desktop browsers—Google Chrome, Microsoft Edge, Mozilla Firefox, Opera, Vivaldi—press Ctrl+U to open a new tab displaying the raw HTML of the page you’re on. On a Mac, press Cmd+Option+U, or Cmd+U in Firefox.
Alternatively, all desktop browsers support a URL-specific tweak. Add the text view-source: to the URL to open the page in source mode. For example, type view-source:https://www.lifewire.com to view the source code behind Lifewire's main landing page.
The default Android browser allows the view-source: URL tweak. However, on iOS, the default Safari app does not support this feature. On Apple's platform, you will need to launch a different browser or a source code viewer app from the App Store.