How to Open an HTML File in Chrome (4 Easy Methods)
Learn how to open HTML files in Chrome browser. Step-by-step guide covering drag-and-drop, file menu, keyboard shortcuts, and online HTML viewers.
Need to view an HTML file in your browser? Chrome makes it easy to open local HTML files for testing, previewing, or viewing web pages offline. This guide shows you four different methods.
Method 1: Drag and Drop (Easiest)
The simplest way to open an HTML file in Chrome:
- Open Chrome browser
- Open your file explorer/finder
- Find your HTML file
- Drag the file into Chrome
- Drop it in the browser window
The HTML file will open immediately in a new tab.
Method 2: File Menu
Use Chrome's built-in file menu:
- Open Chrome
- Press
Ctrl+O(Windows) orCmd+O(Mac) - Navigate to your HTML file
- Select it and click "Open"
Alternatively:
- Click the three-dot menu (⋮) in Chrome
- Select "Open File..."
- Browse to your HTML file
- Click "Open"
Method 3: Address Bar
Type the file path directly:
- Open Chrome
- Click the address bar
- Type:
file:///followed by the path - Press Enter
Example paths:
- Windows:
file:///C:/Users/Name/Desktop/page.html - Mac:
file:///Users/Name/Desktop/page.html - Linux:
file:///home/name/Desktop/page.html
Method 4: Use an Online HTML Viewer
For a better viewing experience with syntax highlighting:
- Go to LinkyHost HTML Viewer
- Upload or paste your HTML code
- View rendered output and source code
- Share with others via link
Benefits of online viewers:
- Syntax highlighting
- Easy sharing
- Works on any device
- No local file access needed
How to Open HTML Files in Chrome on Different Devices
Windows PC
Drag and drop:
- Open File Explorer
- Navigate to your HTML file
- Drag into Chrome window
Right-click method:
- Right-click the HTML file
- Select "Open with"
- Choose "Google Chrome"
Set Chrome as default:
- Right-click any HTML file
- Select "Open with" → "Choose another app"
- Select Chrome
- Check "Always use this app"
Mac
Drag and drop:
- Open Finder
- Locate your HTML file
- Drag into Chrome
Right-click method:
- Right-click (or Ctrl+click) the HTML file
- Select "Open With"
- Choose "Google Chrome"
Set as default:
- Right-click the HTML file
- Click "Get Info"
- Under "Open with," select Chrome
- Click "Change All..."
Chromebook
- Open the Files app
- Find your HTML file
- Double-click to open in Chrome
- Or right-click → "Open with" → "View"
How to Run HTML Code in Chrome
If you want to test HTML code (not just view a file):
Option 1: Developer Tools Console
- Open Chrome
- Press
F12orCtrl+Shift+I - Go to "Console" tab
- Type:
document.write('<h1>Hello</h1>') - Press Enter
Option 2: Create a Local File
- Open Notepad (Windows) or TextEdit (Mac)
- Write your HTML code
- Save as
test.html - Open in Chrome using methods above
Option 3: Use LinkyHost HTML Viewer
- Go to HTML Viewer
- Paste your HTML code
- See the rendered result instantly
- Share via link if needed
Troubleshooting
HTML File Opens as Text
If Chrome shows raw code instead of rendered HTML:
- Check the file extension is
.htmlor.htm - Ensure the file starts with proper HTML tags
- Try right-clicking → "Open with" → Chrome
CSS/JavaScript Not Loading
When opening local HTML files:
- External CSS/JS files must be in the same folder or use relative paths
- Some features may be blocked due to security restrictions
- Consider using a local server for complex projects
Images Not Showing
- Use relative paths:
<img src="images/photo.jpg"> - Or absolute paths:
<img src="file:///C:/path/to/image.jpg"> - Check that image files exist in the specified location
Frequently Asked Questions
How do I open an HTML file in Chrome on my computer?
The easiest way is drag and drop. Open your file explorer, find the HTML file, and drag it directly into an open Chrome window.
How do I view HTML code in Chrome?
To view the source code of any page in Chrome, press Ctrl+U (Windows)
or Cmd+Option+U (Mac). For your own HTML files, you can also use
LinkyHost's HTML Viewer for syntax highlighting.
Can I edit HTML in Chrome?
Yes! Press F12 to open Developer Tools, then you can edit the HTML
directly in the Elements panel. Changes are temporary and reset when
you refresh.
How do I make Chrome the default for HTML files?
Right-click any HTML file, select "Open with" or "Get Info," choose Chrome, and set it as the default application.
Why won't my HTML file open in Chrome?
Check that: (1) the file has a .html extension, (2) Chrome is installed, (3) the file isn't corrupted. Try opening via File → Open or drag/drop.
Related Tools and Guides
- Online HTML Viewer - View HTML with syntax highlighting
- HTML to Website Converter - Turn HTML into a live website
- Free Website Hosting - Host your HTML files online
Conclusion
Opening an HTML file in Chrome is straightforward - just drag and drop the file into your browser window. For sharing HTML files with others or viewing with syntax highlighting, try LinkyHost's HTML Viewer.