sodcalculator

10 Tech How-To

How to Inspect Elements on iPhone (Safari & Chrome)

Guide 10-45916 · Updated · Step by step

Inspecting elements on an iPhone lets you view and temporarily edit the HTML, CSS, and JavaScript of any webpage directly from your device. It’s invaluable for web developers, designers, and curious users who want to debug a layout, test changes on the fly, or understand how a site is built. This guide covers two methods: using Safari’s built-in Web Inspector (via a Mac) and using a third-party browser with a built-in inspector, so you can choose the one that fits your setup.

What You’ll Need

  • An iPhone running iOS 14 or later (for Safari) or iOS 12 or later (for third-party browsers).
  • For Safari method: a Mac with Safari 13 or later, and a USB cable (or same Wi-Fi network).
  • For Chrome method: the Google Chrome app installed on your iPhone.

Step-by-Step

Method 1: Using Safari Web Inspector (Requires a Mac)

  1. Enable Web Inspector on your iPhone: Open the Settings app, tap Safari, scroll down to Advanced, and toggle on Web Inspector.
  2. Enable Develop menu on your Mac: Open Safari on your Mac. In the menu bar, go to Safari > Settings (or Preferences). Click the Advanced tab, then check the box at the bottom that says Show features for web developers. Close the settings window.
  3. Connect your iPhone to your Mac: Use a USB cable to connect your iPhone to your Mac. If you’re on the same Wi-Fi network, you can also connect wirelessly (see Tips).
  4. Open the webpage you want to inspect on your iPhone: Use Safari on your iPhone to navigate to the page you want to debug.
  5. Open the Web Inspector on your Mac: On your Mac, in Safari’s menu bar, click Develop. You’ll see a list of connected devices. Hover over your iPhone’s name, and a submenu will appear showing the open tabs. Click the tab you want to inspect.
  6. Inspect and edit elements: A new window will open on your Mac with the Web Inspector. At the top, you’ll see tabs like Elements, Console, Sources, and Network. Click Elements to see the HTML structure. Click any element to select it, and the right panel will show its CSS styles. You can edit text, change attribute values, or modify CSS properties directly. Changes are temporary and revert when you refresh the page.

Method 2: Using Chrome’s Built-in Inspector (No Mac Needed)

  1. Install Google Chrome: If you don’t have it, download and install the Chrome app from the App Store.
  2. Open the page you want to inspect: Launch Chrome and navigate to the webpage you want to debug.
  3. Access the inspector: Tap the Share button (square with arrow) in the bottom toolbar. Scroll down and tap Inspect (if you don’t see it, you may need to scroll to the bottom of the share sheet and tap “Edit Actions” to add it).
  4. Use the inspector: A bottom panel will appear showing the HTML structure. Tap any element to highlight it on the page. You can tap the > arrow to expand child elements. To edit an element, long-press it and choose Edit as HTML. You can also tap the Styles tab at the top to view and modify CSS properties.

Common Mistakes

  • Forgetting to enable Web Inspector on the iPhone: If you skip step 1 of Method 1, your iPhone won’t appear in the Develop menu.
  • Using the wrong browser: Web Inspector only works with Safari on the iPhone. If you’re using Chrome on the iPhone, you can’t inspect it via the Mac’s Safari Develop menu.
  • Expecting changes to be permanent: Any edits you make in the inspector are temporary. They revert as soon as you refresh the page. To make permanent changes, you need to edit the source code on the server.
  • Not seeing the Develop menu on Mac: The Develop menu is hidden by default. If you don’t see it in the menu bar, you haven’t enabled it via Safari > Settings > Advanced.

Tips

  • Use wireless debugging: With both devices on the same Wi-Fi network, you can inspect without a cable. After connecting via USB once and enabling Web Inspector, you can disconnect the cable and still see your iPhone in the Develop menu (as long as both devices are on the same network and Bluetooth is on).
  • Quickly find an element: In the Elements panel, you can search for a specific element by pressing Cmd+F on Mac or using the search bar in Chrome’s inspector. Type a CSS selector, like .header or #footer, to jump to it.
  • Use the Console for JavaScript: The Console tab lets you run JavaScript commands against the page. For example, you can type document.title to see the page title, or alert('Hello') to test a popup.
  • Test responsive design: In Safari’s Web Inspector, you can click the Responsive Design Mode icon (a rectangle with a phone inside) to simulate different screen sizes and see how the page behaves on various devices.

Troubleshooting

  • iPhone not showing in Develop menu: Check that Web Inspector is enabled on the iPhone (Settings > Safari > Advanced). Also, ensure the USB cable is connected and the iPhone is unlocked. If you’re using wireless debugging, make sure both devices are on the same Wi-Fi network and Bluetooth is enabled.
  • Develop menu is grayed out: This usually means Safari can’t detect your iPhone. Try disconnecting and reconnecting the cable, or restarting both Safari on the Mac and Safari on the iPhone.
  • Chrome’s Inspect option is missing: The “Inspect” action might be hidden in the share sheet. Tap “Edit Actions” at the bottom of the share sheet, then add “Inspect” to your favorites. If it’s still not there, make sure Chrome is updated to the latest version.
  • Inspector opens but shows a blank page: This can happen if the page uses heavy JavaScript that hasn’t loaded yet. Wait a few seconds, or refresh the page and try again.

Frequently Asked Questions

Can I inspect elements on an iPhone without a Mac?

Yes, you can use the Chrome app’s built-in inspector, which doesn’t require a Mac. However, it’s less full-featured than Safari’s Web Inspector.

Are the changes I make in the inspector permanent?

No, all changes are temporary and revert when you refresh the page. To make permanent changes, you need to edit the website’s source code and upload it to the server.

Can I inspect elements on any website?

Yes, you can inspect any publicly accessible webpage. Some sites may block certain features or use obfuscated code, but the inspector will still show the rendered HTML and CSS.

How do I view a specific element’s CSS in Safari’s inspector?

Click the element in the Elements tab, and the right-hand panel will show its CSS styles. You can also click the “Computed” tab to see the final computed styles after all cascading rules are applied.

Can I use the inspector to edit JavaScript?

Yes, you can use the Console tab to execute JavaScript, and the Sources tab to view and debug the page’s scripts. However, you cannot directly edit and save the JavaScript source from the inspector; you can only modify it temporarily in memory.

Does inspecting elements work on all iOS versions?

Web Inspector has been available since iOS 6, but the interface has evolved. The steps above work for iOS 14 and later. For older versions, the general process is similar, but some menu names may differ.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →