With the browser plugin uBlock Origin, you can block shares from Instagram with the custom rule:
www.facebook.com##.html-div:has(a[href*="www.instagram.com"])
Note: Facebook changes their css often. This may not work for long.
How to Block Instagram Shares from Facebook Using uBlock Origin: A Complete Guide
Social media platforms have become increasingly interconnected, with content from one platform frequently appearing on another. For Facebook users, this often means encountering Instagram shares in their news feed—sometimes from accounts they follow on both platforms, creating redundant content, and sometimes from accounts they don't follow on Instagram at all, courtesy of Facebook's algorithmic recommendations.
If you're looking to curate a cleaner Facebook experience by filtering out these Instagram cross-posts, browser extensions like uBlock Origin offer a powerful solution through custom filtering rules. This guide will walk you through the process of blocking Instagram shares from your Facebook feed, explain how the technology works, and discuss the limitations you should be aware of.
Understanding the Problem: Why Instagram Shares Appear on Facebook
Before diving into the solution, it's helpful to understand why Instagram content appears so frequently on Facebook in the first place.
Facebook acquired Instagram in 2012 for approximately $1 billion, and since then, the two platforms have become increasingly integrated. While they maintain separate user interfaces and distinct user experiences, Meta (Facebook's parent company) has strong incentives to encourage cross-platform engagement.
When users share their Instagram posts to Facebook, it serves multiple purposes from Meta's perspective: it increases engagement on both platforms, keeps users within the Meta ecosystem longer, and exposes Facebook users to Instagram content they might not otherwise see. For the company, this cross-pollination is a feature, not a bug.
For individual users, however, the experience can be less than ideal. If you've carefully curated separate follows on each platform—perhaps following friends and family on Facebook while reserving Instagram for photographers, artists, or specific interest accounts—these Instagram shares can feel like an unwanted intrusion. You've made deliberate choices about which content you want to see on which platform, and the cross-posting undermines that curation.
Additionally, Facebook's algorithm doesn't limit Instagram shares to accounts you follow. You may see Instagram content from complete strangers, shared by people you're connected with on Facebook, or simply surfaced by Facebook's recommendation system. This can quickly clutter your feed with content you never requested.
What is uBlock Origin?
uBlock Origin is a free, open-source browser extension available for Chrome, Firefox, Edge, Safari, and other major browsers. While many people know it primarily as an ad blocker, its capabilities extend far beyond simply hiding advertisements.
At its core, uBlock Origin is a content filtering engine. It can block network requests (preventing ads, trackers, and other resources from loading) and hide page elements using cosmetic filtering (making specific parts of a webpage invisible without preventing them from loading). This second capability—cosmetic filtering—is what we'll use to hide Instagram shares from Facebook.
uBlock Origin was created by Raymond Hill and has become one of the most popular browser extensions worldwide, with millions of active users. It's known for being lightweight, efficient, and highly customizable. Unlike some ad blockers that accept payment from advertisers to whitelist their ads, uBlock Origin maintains strict neutrality and doesn't participate in "acceptable ads" programs.
The extension is entirely free and doesn't collect user data, making it a privacy-friendly choice for users who want more control over their browsing experience.
The Solution: A Custom uBlock Origin Filter
If you have uBlock Origin installed, you can add a custom filter that will hide Instagram shares from your Facebook feed:
www.facebook.com##.html-div:has(a[href*="www.instagram.com"])
This single line of code tells uBlock Origin to identify and hide specific content on Facebook. Let's break down what each part does before we walk through the implementation process.
Understanding the Filter Syntax
uBlock Origin uses a specific syntax for its filtering rules. Understanding this syntax will help you troubleshoot if the filter stops working (which we'll discuss later) and enable you to create your own custom filters for other purposes.
The filter consists of several components:
Domain specification: www.facebook.com## - This tells uBlock Origin to apply the rule only when you're visiting Facebook. The double hash marks (##) indicate that this is a cosmetic filter (hiding page elements) rather than a network filter (blocking requests).
Element selector: .html-div - This targets HTML div elements that have the CSS class "html-div". As of late 2025, Facebook uses this class name for the containers that hold individual posts in your news feed. The period before "html-div" is CSS syntax indicating a class name.
Content matcher: :has(a[href*="www.instagram.com"]) - This is where the magic happens. The :has() pseudo-class is a relatively modern CSS feature that allows you to select parent elements based on what they contain. In this case, we're looking for elements that contain (has) a link (a) whose URL (href) includes (*=) the string "www.instagram.com".
Put together, the filter finds div elements with the class "html-div" that contain links to Instagram, then hides them from view. Since Instagram shares in Facebook posts always include a link back to the original Instagram post, this effectively targets all Instagram cross-posts.
Step-by-Step Implementation Guide
Here's how to add this custom filter to uBlock Origin:
Step 1: Install uBlock Origin (if you haven't already)
If you don't have uBlock Origin installed, visit your browser's extension store:
- Chrome/Edge: Chrome Web Store
- Firefox: Firefox Add-ons
- Safari: Mac App Store
Search for "uBlock Origin" (make sure you get "uBlock Origin" specifically, not "uBlock" or other similarly-named extensions) and install it.
Step 2: Open the uBlock Origin Dashboard
Click the uBlock Origin icon in your browser's toolbar (it looks like a shield with "0" or a number inside). In the popup that appears, click the gear icon in the bottom-right corner. This will open the uBlock Origin dashboard in a new tab.
Step 3: Navigate to Custom Filters
In the dashboard, you'll see several tabs at the top. Click on "My filters". This is where you can add custom filtering rules that supplement uBlock Origin's built-in filter lists.
Step 4: Add the Filter
In the text box on the "My filters" page, add this line:
www.facebook.com##.html-div:has(a[href*="www.instagram.com"])
You can paste it on its own line. If you already have other custom filters, just add it as a new line.
Step 5: Apply the Changes
Click the "Apply changes" button in the top-left corner of the page. This saves your custom filter and activates it immediately.
Step 6: Refresh Facebook
Navigate to Facebook (or refresh the page if you already have it open). Instagram shares should now be hidden from your news feed.
How the Filter Works Technically
When you load Facebook with this filter active, uBlock Origin performs the following process:
First, it checks if the current page matches the domain specification (www.facebook.com). If you're on Facebook, it proceeds; if not, it ignores this rule.
Second, it scans the page's HTML structure looking for all div elements with the class "html-div". Facebook's news feed is composed of many such divs, each containing a single post.
Third, for each of these divs, it checks whether the div contains a link to Instagram. It does this by looking for anchor (<a>) elements whose href attribute (the URL the link points to) includes "www.instagram.com".
Fourth, for any div that matches all these criteria, uBlock Origin applies CSS styling to hide it from view. The element is still in the page's HTML—it just has display: none or similar CSS applied to make it invisible.
This process happens almost instantaneously as the page loads, so you typically won't see Instagram shares flash briefly before disappearing. They simply never appear in your visible feed.
Browser Compatibility and Requirements
This filter relies on the CSS :has() pseudo-class, which is a relatively recent addition to the CSS specification. Fortunately, browser support has become widespread:
- Chrome/Edge: Supported since version 105 (August 2022)
- Firefox: Supported since version 121 (December 2023)
- Safari: Supported since version 15.4 (March 2022)
If you're using an up-to-date version of any major browser, this filter will work. However, if you're using an older browser version, the :has() selector won't function, and the filter won't hide Instagram shares.
You can verify your browser supports :has() by checking caniuse.com or simply by implementing the filter and seeing if it works.
The Critical Limitation: Facebook's Changing Code
Here's the most important thing to understand about this solution: it will eventually stop working.
Facebook doesn't publish stable, documented CSS class names for third-party developers to use. The company regularly changes its HTML structure and CSS classes, sometimes weekly, sometimes monthly. These changes happen for various reasons:
Redesigns and feature updates: Facebook constantly tests new layouts and features, which often require restructuring the underlying HTML.
A/B testing: Facebook runs extensive A/B tests, showing different versions of the site to different users. These tests may use different class names or HTML structures.
Performance optimization: Facebook's engineering teams regularly optimize their code for performance, which can involve changing how elements are structured.
Security considerations: Changing class names and HTML structure can make it slightly harder for scrapers and automated tools to extract data from Facebook.
The .html-div class name referenced in our filter is current as of October 2025. It might still be in use when you read this, or Facebook might have changed it to .post-container, .feed-item, .newsfeed-post, or something entirely different.
What Happens When Facebook Changes Its Code
When Facebook changes the class name used for post containers, this filter will stop working. You won't receive an error message or notification—Instagram shares will simply start appearing in your feed again.
At that point, you have two options: give up on filtering Instagram shares, or update the filter to work with Facebook's new structure.
How to Update the Filter When It Breaks
If the filter stops working, you can identify Facebook's new class names and update the filter yourself. Here's how:
Step 1: Open Facebook's Developer Tools
Right-click on any post in your Facebook feed (preferably an Instagram share, if you can identify one) and select "Inspect" or "Inspect Element" from the context menu. This will open your browser's developer tools, showing you the HTML structure of the page.
Step 2: Identify the Post Container
Look for the HTML element that wraps the entire post. It will typically be a <div> element. In the developer tools, you can hover over different elements in the HTML tree to highlight them on the page, making it easier to identify which element corresponds to the post container.
Step 3: Find the Class Name
Once you've identified the div that contains the post, look at its attributes. You'll see something like:
<div class="some-class-name another-class" data-some-attribute="value">
The class attribute may contain one or multiple class names separated by spaces. You're looking for the class that Facebook uses consistently for all post containers.
Step 4: Update Your Filter
Go back to uBlock Origin's "My filters" tab and replace .html-div in your filter with the new class name you identified. For example, if Facebook is now using .post-wrapper, your filter would become:
www.facebook.com##.post-wrapper:has(a[href*="www.instagram.com"])
Step 5: Apply and Test
Click "Apply changes" and refresh Facebook to see if the updated filter works.
This process requires some technical comfort, but it's not particularly difficult once you've done it a few times. Think of it as a maintenance task you'll need to perform occasionally to keep the filter working.
Alternative Approaches and Considerations
While this custom filter is effective, it's worth considering alternative approaches to managing Instagram content on Facebook:
Unfollow or Unfriend: The most permanent solution is to unfollow or unfriend people who frequently share Instagram content to Facebook. This is nuclear option but requires no technical maintenance.
Use Facebook's "Hide" Feature: You can hide individual Instagram shares by clicking the three dots in the corner of a post and selecting "Hide post". Facebook's algorithm may learn from this over time, though results vary.
Separate Your Platforms: Consider using Facebook and Instagram completely separately, checking each app independently rather than relying on cross-posted content. This requires discipline but gives you the most control.
Use a Third-Party Client: Some third-party Facebook clients offer more granular content filtering. However, Facebook has been restrictive about third-party API access in recent years, limiting this option.
Browser Extensions Beyond uBlock Origin: Other content filtering extensions exist, though most serve similar purposes to uBlock Origin and would face the same maintenance challenges.
The uBlock Origin approach strikes a balance: it's effective when it works, requires minimal ongoing effort (just occasional updates), and doesn't require you to change your social media habits significantly.
Privacy and Security Considerations
Using custom filters in uBlock Origin doesn't send any data to external servers or create privacy risks. The filtering happens entirely in your browser, on your device. Facebook cannot detect that you're using this filter—from their perspective, your browser is simply not displaying certain elements, which could happen for many reasons.
However, it's worth noting that hiding Instagram shares doesn't prevent Facebook from collecting data about them. The posts still load in your browser's memory; they're just hidden from view. If you're concerned about Facebook tracking which Instagram content you're exposed to, you'd need to use network-level blocking rather than cosmetic filtering, but that would be significantly more complex and might break Facebook's functionality.
The Broader Context: Taking Control of Your Social Media Experience
This filter represents a small example of a larger principle: taking active control of your online experience rather than passively accepting what platforms present to you.
Social media companies design their platforms to maximize engagement, which often means showing you content algorithmically determined to keep you scrolling. Instagram shares on Facebook serve Meta's business interests—keeping you engaged across multiple properties—but they may not serve your interests.
Custom filters, while requiring some technical knowledge and occasional maintenance, let you reshape these platforms closer to your preferences. You're not entirely at the mercy of Facebook's algorithm; you have tools to push back.
This same principle applies beyond just blocking Instagram shares. uBlock Origin can hide ads, recommended content, "People You May Know" suggestions, and countless other elements of Facebook (or any website) that you find distracting or unwanted. The limit is primarily your willingness to learn the filtering syntax and maintain your rules as websites change.
Conclusion
Blocking Instagram shares from Facebook using uBlock Origin is straightforward: add the custom filter www.facebook.com##.html-div:has(a[href*="www.instagram.com"]) to your "My filters" list, apply the changes, and refresh Facebook.
The solution works effectively as of October 2025, but comes with an important caveat: Facebook regularly changes its HTML structure and CSS class names, which will eventually break this filter. When that happens, you'll need to inspect Facebook's current code and update the filter accordingly.
For users who value a curated social media experience and don't mind occasional technical maintenance, this approach offers a practical middle ground between accepting Facebook's default presentation and abandoning the platform entirely.
The filter gives you back a small measure of control over what appears in your feed, letting you maintain clearer boundaries between different social media platforms and consume content more intentionally.
Whether that control is worth the eventual maintenance burden depends on how much Instagram cross-posting bothers you and how comfortable you are with basic web development tools. But for those who want it, the option exists.
