How to Inspect Elements on Mac in Safari or Chrome
In this article
Inspecting elements lets you view and temporarily edit the HTML, CSS, and JavaScript of any webpage directly in your browser. It's essential for web developers, designers, and curious users who want to understand how a site is built, test changes, or debug issues. On a Mac, both Safari and Chrome have built-in developer tools that make this easy. You'll need a Mac with Safari or Chrome installed, and for Safari, you may need to enable the Develop menu first. No coding experience is required, but basic familiarity with HTML/CSS helps.
What You'll Need
- A Mac running macOS (any recent version).
- Safari or Google Chrome installed (both come pre-installed or are free to download).
- For Safari: the Develop menu must be enabled (see Step 1).
- Optional: a web page you want to inspect (any site works).
Step-by-Step
In Google Chrome
- Open Chrome and navigate to the webpage you want to inspect.
- Right-click (or Control-click) on the specific element you want to examine (e.g., a heading, image, or button). A context menu appears.
- Select “Inspect” from the menu. The Developer Tools panel opens, usually docked at the bottom or right side of the window. The selected element is highlighted in the Elements tab.
- Alternative method: Press Option + Command + C on your keyboard to open the Developer Tools directly to the Elements tab. Or press Option + Command + I to open the last-used tab.
- Explore the panel: The left side shows the HTML structure (DOM). The right side shows the CSS styles applied to the selected element. You can click any HTML tag to select it, and the corresponding styles will update.
- Edit live: Double-click any text or attribute in the HTML to edit it. Changes appear instantly on the page but are temporary—they disappear when you refresh the page.
- Close the panel: Click the X in the top-right corner of the Developer Tools, or press Option + Command + I again.
In Safari
- Enable the Develop menu: Open Safari, then go to Safari > Settings (or Preferences) in the top menu bar. Click the Advanced tab, then check the box next to “Show features for web developers” at the bottom. Close the settings window.
- Navigate to the webpage you want to inspect.
- Right-click (or Control-click) on the element you want to inspect. Choose “Inspect Element” from the context menu. The Web Inspector opens at the bottom of the window.
- Alternative method: With the Develop menu visible, you can also click Develop > Show Web Inspector in the menu bar, or press Option + Command + I.
- Use the inspector: The left pane shows the HTML structure; the right pane shows CSS styles. Click any element in the HTML to see its styles. You can also use the “Select an element” button (the cursor icon) in the inspector’s toolbar to click directly on the page and highlight the corresponding HTML.
- Edit live: Double-click any HTML text or attribute to edit it. Changes are temporary and revert on page refresh.
- Close the inspector: Click the X in the top-left corner of the Web Inspector, or press Option + Command + I again.
Common Mistakes
- Right-clicking on a blank area: If you right-click on empty space, you might inspect the or a container, not the element you intended. Always right-click directly on the visible element.
- Forgetting to enable the Develop menu in Safari: If you don't see “Inspect Element” in the context menu, the Develop menu is likely disabled. Follow Step 1 for Safari.
- Editing and then refreshing: Any changes you make in the inspector are lost as soon as you refresh the page. If you want to keep changes, copy the edited code to your own files.
- Confusing HTML and CSS panes: In Chrome, the Elements tab shows HTML on the left and CSS on the right. In Safari, the same layout applies. Don't try to edit CSS in the HTML pane—use the styles pane.
- Inspecting elements in an iframe: If the element is inside an embedded frame (like a YouTube video), the inspector might show the parent page. You may need to switch to the iframe context in the console or use the frame selector in the inspector.
Tips
- Use the arrow (cursor) icon: Both Chrome and Safari have a “Select an element” button in the inspector toolbar. Click it, then click on the live page to instantly jump to that element in the HTML.
- Search within the HTML: Press Command + F in the Elements tab to search for specific tags, classes, or IDs.
- Toggle device mode: In Chrome, click the device icon (or press Option + Command + M) to simulate a mobile viewport. This is handy for responsive design testing.
- Use the Console tab: The Console allows you to run JavaScript snippets. For example, type
document.titleand press Enter to see the page title. This is useful for debugging. - Copy the element: Right-click an element in the HTML pane and choose “Copy > Copy element” to get the HTML, or “Copy > Copy styles” to get the CSS.
- Undo changes: If you edit something and want to revert, simply refresh the page—all changes are reset.
Troubleshooting
- “Inspect Element” is grayed out or missing in Safari: This almost always means the Develop menu is disabled. Go to Safari > Settings > Advanced and check “Show features for web developers.” If it's already checked, try restarting Safari.
- Developer Tools won't open in Chrome: Try quitting Chrome completely (Command + Q) and reopening it. If that fails, check if Chrome has any extensions that might interfere—try disabling extensions or using an Incognito window.
- The inspector opens but shows a blank page: This can happen if the page hasn't fully loaded. Wait a moment, or refresh the page while the inspector is open.
- You can't find the element you're looking for: Use the “Select an element” tool and click directly on the page. If the element is dynamically generated (e.g., a popup), you may need to keep the inspector open while interacting with the page.
- Changes don't appear on the page: Make sure you're editing the correct element. Check that the element you selected in the HTML pane is the one you want. Also, some CSS properties might be overridden by other rules—look for strikethrough text in the styles pane.
- Keyboard shortcuts don't work: On some Mac keyboards, you may need to use the fn key. Try fn + Option + Command + I if the shortcut doesn't respond.
Frequently Asked Questions
Is inspecting elements legal?
Yes. Inspecting elements is a standard browser feature used by developers. It only lets you view and temporarily edit the page in your own browser—it doesn't modify the website for anyone else.
Can I permanently change a website by inspecting elements?
No. Changes you make in the inspector are local to your browser session and disappear when you refresh or leave the page. To make permanent changes, you need to edit the actual source files on the server, which requires access to the website's code.
Why would I inspect elements if I'm not a developer?
It's useful for learning how websites are built, testing design changes before implementing them, removing distracting elements temporarily, or saving an image that's protected by right-click disable (though you should respect copyright).
What's the difference between the Elements tab and the Console?
The Elements tab shows the HTML and CSS structure of the page. The Console is a JavaScript command line where you can run code, see errors, and interact with the page programmatically.
Can I inspect elements on a mobile device?
Yes, but it's more complex. You can use remote debugging: connect your iPhone or Android device to your Mac via USB, then use Safari or Chrome's developer tools to inspect the mobile page. This requires enabling developer mode on the device.
Does inspecting elements slow down my Mac?
No. The developer tools only run when you have them open. They may consume a small amount of memory, but they don't affect system performance when closed.