Skip to content

The algorithm

Inside X's open-source algorithm

The real weights in X's published feed code, and what they mean for how you post.

  • 2 min read
  • In progress
  • Sourced

Ask AI about this guide

Opens your assistant with this guide already loaded, so you can ask how it applies to you.

Share this guide

Inside X's open-source algorithm

Do this today

  1. Write posts people would copy the link to and send.

    Share via copy link carries the biggest positive weight in the 2026 code.X code, 2026

  2. Aim for replies, not likes.

    A reply is weighted about 7× a like in the 2026 code.X code, 2026

  3. Avoid anything your audience would mute, block or report.

    Negative actions carry large penalties.X code

The short version: X is the only major platform that publishes the code behind its main feed. It predicts how likely you are to take each of dozens of actions on a post, multiplies each prediction by a published weight, and adds them up. In the current code, the predicted chance of a reply, quote or DM share is weighted about 7 times as heavily as the chance of a like, sharing via copied link about 28 times, and “not interested,” mute, block and report all carry heavy penalties. Those weights apply to predictions, not counts, which the calculator below makes concrete. From the code

  • Write for replies, quotes and sends, not likes. Those weights are several times higher than a like. Code, applied
  • Make posts people want to share outside X. Sharing via copied link is the single highest positive weight in the 2026 code. Code, applied
  • Don’t get muted. Predicted mutes and “not interested” carry large negative weights, and mutes also filter you out of that person’s feed entirely. Code, applied
  • Post consistently, not in bursts. Author diversity discounts your second and third post in the same feed, and posts older than 48 hours drop out of For You. From the code
  • New accounts get a lift. The new-author boost exists so low-impression accounts get seen. Your early posts matter. From the code
  • Don’t treat weights as permanent. The reply weight went from 13.5 to 5 between releases. Build for the audience, and use the code to understand direction, not to game a number.

What happens every time someone opens For You, in the order the 2026 README lays out. From the code

  1. 1. Read the viewerPull their recent engagements, who they follow, and who they’ve blocked or muted. The engagement history is the model’s main input.
  2. 2. Gather candidatesIn parallel: Thunder (recent posts from accounts you follow), Phoenix retrieval (posts from everyone else that match you), SimClusters (posts popular in communities like yours) and a shared list of popular posts.
  3. 3. Fill in detailsAttach the text, media, author, language and engagement counts to each candidate.
  4. 4. FilterDrop duplicates, posts older than 48 hours, your own posts, blocked or muted accounts, and anything you’ve already seen.
  5. 5. ScorePhoenix predicts the chance of each action. The ranker multiplies by the weights below, then discounts repeat authors and out-of-network posts and boosts new authors.
  6. 6. Pick the topSort by final score and keep the best.
  7. 7. Final checksVisibility rules remove posts that labels say can’t be shown, and extra replies from the same conversation are collapsed.
After this, a separate step mixes in ads and “Who to follow.” Source: xai-org/x-algorithm README.

These are the numbers the ranker multiplies each predicted action by. Toggle between the two releases to see how much changed.

From the code · Ranking weights

What X’s ranker multiplies each predicted action by

  • Share via copy link+20
  • Reply+5
  • Quote+5
  • Share via DM+5
  • Follow the author+4
  • Share+2.118
  • Repost+1
  • Like+0.708
  • Time spent after clicking in+0.385
  • Click into the post+0.274
  • Open a link+0.2
  • Scroll past without stopping-0.02
  • Block the author-31.2
  • Not interested-53.07
  • Mute the author-58.8
  • Report-234

Bars use a square-root scale so small weights stay visible. 2023 weights from the-algorithm-ml (dated April 5, 2023). 2026 weights from x-algorithm’s param.rs, which X says a script keeps in sync with production defaults. Weights with a value of zero are left out. X can change them at any time.

Try it · Weights are not counts

Does one report really cancel hundreds of likes?

X’s own explanation

The weights multiply the chance that this viewer takes an action, not how many times it happened. A report is rare, so its chance is tiny. X’s code says the baseline chance of a report is more than 1,000 times lower than a like. Move the sliders.

Like: 0.708 × 0.10+0.071
Report: −234 × 0.0001−0.023

Uses the 2026 like and report weights. Probabilities are examples. Real ones are predicted per viewer, which is also why X says mass-reporting mainly affects what similar accounts see.

What the code showsTwo releases, where posts come from, filters and labels

2023: twitter/the-algorithm

  • About 1,500 candidates per request, roughly half from accounts you follow
  • A neural network of about 48M parameters predicts 10 kinds of engagement
  • Weights published as of April 5, 2023

2026: xai-org/x-algorithm

  • A Grok-based transformer called Phoenix ranks posts from the viewer’s recent engagement history
  • Predicts many more actions, including dwell time, shares by DM and copy link, and follows
  • Filtering and visibility code published, with dated updates
What each public release covers

Where posts come from. Posts from accounts you follow come from a service called Thunder. Posts from accounts you don’t follow come from Phoenix retrieval and SimClusters, plus a shared list of popular recent posts. Both kinds are ranked by the same model. From the code

Three adjustments after scoring:

  • Author diversity. Each extra post from the same author in one feed is multiplied by a shrinking factor, down to a floor.
  • Out-of-network discount. Posts from accounts the viewer doesn’t follow are multiplied by a factor below 1.
  • New-author boost. Posts from authors with few impressions are lifted toward a target position.

What gets filtered before ranking, among others: duplicates, posts older than 48 hours, posts the viewer has already seen, posts from blocked or muted accounts, posts matching muted keywords, and, for new accounts, out-of-network posts below an engagement threshold. From the code

Ranking and visibility are separate. Ranking sets the order. A separate visibility system decides whether a post can be shown at all, based on blocks, mutes and labels other systems attach to posts and accounts. Some of those rules apply only when the post is recommended to people who don’t follow you. From the code

You can check your labels. X’s “Under the Hood” tool shows visibility-limiting labels on your account and posts. Use it before believing you’re “shadowbanned.” From the code

Visual breakdowns by othersExplainers worth your time, with caveats

People have drawn this system out in more detail. These are the ones worth your time, with caveats:

  • cneuralnetwork/x-algorithm-explained: an interactive whiteboard and PDF walk-through that pins the exact commit it read. The most careful visual explainer we found.
  • ByteByteGo: The Algorithm That Powers Your X Post (Feb 25, 2026): clean diagrams for a general audience. It oversimplifies in places, for example saying hand-written rules were almost entirely replaced, when the README still lists rule-based filters and visibility checks.

Skip summaries that claim there are “no hand-engineered features.” The published filters and visibility rules say otherwise.

Sources4 sources