User Agents

Web browsers and everyday web tech, explained

Change Visited Link Color in Safari (Mac & iPhone)

· 5 min read · Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Changing the color of visited links in Safari is not a built-in setting, but you can achieve it by overriding Safari's default styles with a custom CSS stylesheet. This guide shows you how to do it on both macOS and iOS (iPhone/iPad) using the built-in "Website-Specific Settings" or a user stylesheet. You'll need a text editor (like TextEdit on Mac) and, for iOS, a way to create a file (like the Files app or a notes-to-file workaround).

What You'll Need

  • A Mac or iPhone/iPad with Safari.
  • A text editor (TextEdit on Mac, or any plain text app on iOS).
  • Basic comfort with copying and pasting CSS code.
  • For iOS, a method to save a .css file (e.g., the Files app or a cloud drive).

Step-by-Step

On macOS (Safari 15 and later)

  1. Create a CSS file: Open TextEdit (or any plain text editor). Go to Format > Make Plain Text (or press Cmd+Shift+T). Paste the following code:
    a:visited { color: #800080 !important; }
    Replace #800080 with any hex color you want (e.g., #ff0000 for red). Save the file as custom.css (make sure the extension is .css, not .rtf).
  2. Open Safari's Settings: Launch Safari, then go to Safari > Settings (or press Cmd+,). Click the Advanced tab.
  3. Enable the Develop menu: At the bottom, check the box that says Show features for web developers. This adds a Develop menu to the top bar.
  4. Open the Develop menu: Click Develop in the menu bar, then select User Stylesheets.
  5. Choose your CSS file: In the submenu, click Choose… and select the custom.css file you created. The visited link color will apply immediately to all websites.

On iPhone/iPad (iOS 15 and later)

  1. Create the CSS file: On your iPhone, open the Files app. Go to On My iPhone (or iCloud Drive). Tap the + icon in the top-right and choose New Folder. Name it something like CSS. Open that folder, tap the + icon again, and select New Document. Name it custom.css. Tap the document to open it, then tap the Share icon (square with arrow) and choose Copy to…? Actually, better: Use a text editor app like Textastic or Koder (free) to create and save a .css file. Or, use the Shortcuts app to create a text file. The simplest way: create the file on your Mac (as above) and AirDrop it to your iPhone, saving it to the Files app.
  2. Open Safari Settings: Go to Settings > Safari.
  3. Tap Advanced: Scroll down and tap Advanced.
  4. Enable Website-Specific Settings: Tap Website-Specific Settings (or Website Data in older versions). This is where you can add a custom stylesheet.
  5. Add the stylesheet: Tap Add Stylesheet (or Edit then +). Navigate to your custom.css file in the Files app and select it. The visited link color will now apply to all websites.

Common Mistakes

  • Using the wrong file extension: If you save as .rtf or .txt, Safari won't recognize it as CSS. Make sure it ends in .css.
  • Forgetting the !important rule: Without !important, many websites' own CSS will override your visited link color. Always include it.
  • Not enabling the Develop menu on Mac: If you can't see the Develop menu, you skipped step 3. Recheck the Advanced settings.
  • On iOS, tapping the wrong setting: Make sure you're in Advanced and not just Website Data. The option is specifically called "Website-Specific Settings" or "Add Stylesheet" depending on iOS version.

Tips

  • Test with a link you've already visited: To see the change immediately, visit a page with links, click one, then go back. The clicked link should now show your custom color.
  • Use a color that contrasts with unvisited links: For example, if unvisited links are blue (#0000EE), a common visited color is purple (#551A8B). Choose something clearly different.
  • You can style more than visited links: The same CSS file can also change link colors, hover effects, or even font sizes. Add more lines like a:link { color: blue; }.
  • On Mac, you can toggle the stylesheet: The Develop menu lets you turn it off/on quickly without deleting the file.
  • For iOS, keep the file in iCloud Drive: That way it syncs across your devices, and you can edit it on your Mac later.

Troubleshooting

  • Visited links don't change: First, make sure you've actually visited a link on that page. If not, click a link and go back. If it still doesn't change, check that the CSS file is correctly formatted and that the !important is present. Also, some websites use JavaScript to override link colors; you may need to add a more specific selector like a:visited { color: #800080 !important; } (which you already have). If that fails, try adding body a:visited.
  • On Mac, the Develop menu is missing: Go back to Safari > Settings > Advanced and make sure the checkbox is ticked. If it is, restart Safari.
  • On iOS, the "Add Stylesheet" option is greyed out: This can happen if you haven't given Safari permission to access the Files app. Go to Settings > Privacy > Files and Folders and enable Safari. Then try again.
  • The CSS file won't save as .css on iOS: Use a dedicated text editor app that allows custom file extensions. Or, create the file on a Mac and AirDrop it.
  • Changes affect only some sites: Some sites use inline styles or very specific CSS that overrides even !important. In that case, you can try a more aggressive selector like a:visited:not(:has(span)) but that's advanced. Usually, the basic rule works for most sites.

Frequently Asked Questions

Does this work on Safari for Windows?

No, Safari for Windows is no longer supported and this method is only for macOS and iOS.

Will this change the color of links on all websites?

Yes, the custom stylesheet applies globally to all websites you visit in Safari, unless a site's CSS explicitly overrides it (which is rare with !important).

Can I set different colors for different websites?

Yes, you can use more specific selectors like body.example.com a:visited but that requires knowing the site's domain. A simpler way is to create multiple stylesheets and switch between them via the Develop menu on Mac, but iOS only allows one at a time.

Will this affect my browsing history or privacy?

No, it only changes the visual appearance. It does not alter your history or how Safari tracks visited links.

Can I revert to the default color?

Yes, simply remove the stylesheet (on Mac, choose "None" in the Develop menu; on iOS, delete the stylesheet from Website-Specific Settings).

Is there a way to do this without a custom CSS file?

No, Safari does not offer a built-in setting for visited link colors. This is the only reliable method.