Category: Social Media

How social platforms rank content, from the source code.

  • X Open-Sourced Its Algorithm: How to Go Viral on X, According to the Code (2026)

    X Open-Sourced Its Algorithm: How to Go Viral on X, According to the Code (2026)

    In January 2026, X published the code of its “For You” recommendation system on GitHub, in the xai-org/x-algorithm repository, and has updated it several times since. It is the second time the company has opened its algorithm: the first was in 2023, when it was still called Twitter. Unlike the usual social media advice, the code shows how the feed actually decides what to show, including the exact weight given to each kind of interaction.

    We read the repository to answer one question: what makes a post travel on X? One caveat applies to everything below. The repository publishes default values and notes that production values may differ, and some parts, such as certain prompts and rules, are withheld. The numbers are the best public evidence available, not a guarantee.

    How the For You feed works

    Every time you open the app, the system runs a pipeline with four main steps:

    • Candidate sourcing. It gathers recent posts from accounts you follow (an in-memory service called Thunder) and posts from accounts you do not follow, found by similarity of interests and by a shared list of popular posts.
    • Filtering. It removes duplicates, posts you have already seen, posts from accounts you blocked or muted, posts with muted keywords and posts older than 48 hours.
    • Scoring. A transformer model called Phoenix predicts the probability that you will perform each of about 20 actions with the post: like it, reply, repost, share it, click, watch, follow the author, or mark it as not interesting, mute, block or report.
    • Ranking and mixing. The predictions are combined into one score, adjusted for diversity, and the final feed is blended with ads and recommendations.

    A separate visibility-filtering layer decides whether a post can be shown at all. As the README puts it, ranking decides the order, and visibility filtering decides whether a post appears.

    The formula

    The final score is a weighted sum: for each action, the predicted probability is multiplied by its weight, and the results are added. Positive actions have positive weights, negative ones have negative weights. The weights do not multiply raw counts of likes or replies: they multiply the model’s prediction that this viewer will take that action on this post.

    The weights: what X values most

    These are the default weights published in the repository’s parameter file. Each one tells you how much a predicted action is worth compared with a like.

    ActionWeightWorth in likes
    Share via copy link20.0≈ 30
    Reply between mutual followers (extra boost)+15.0≈ 23
    Reply5.0≈ 7.6
    Quote post5.0≈ 7.6
    Share via direct message5.0≈ 7.6
    Follow the author4.0≈ 6
    Share2.03
    Repost1.01.5
    Like0.661
    Click on the post0.3≈ 0.5
    Open a link0.20.3
    Not dwelled (scrolled past)-0.02small negative
    Block the author-31.2≈ -47
    Mark as not interested-52.3≈ -79
    Mute the author-58.8≈ -89
    Report-234.0≈ -355

    Three conclusions stand out. Likes are the weakest positive signal. Sharing and conversation dominate: a post that people copy to share elsewhere or send by DM is worth many times more than one they like. And negative signals are brutal: one report outweighs hundreds of likes, and a mute cancels about 90.

    What changed since 2023

    The 2023 release (twitter/the-algorithm-ml) published a similar weighted sum with different numbers: a like was worth 0.5, a reply 13.5, a profile click 12, and a reply that the author then engaged with 75. Reports weighed -369 and negative feedback -74.

    The direction is consistent. In both versions, conversation is worth far more than likes and negative feedback is the strongest signal of all. The 2026 version adds more ways to share (DM, copy link) as top signals, and rewards replies between people who follow each other.

    Adjustments that shape reach

    • Author diversity. After your first post in someone’s feed, each additional post from you is multiplied by a decaying factor. Ten posts in a row do not get ten times the reach.
    • Out-of-network discount. Posts from accounts the viewer does not follow are multiplied by a factor below one. Reaching non-followers requires a stronger predicted response.
    • Boost for new and small authors. The parameters define a cold-start mechanism for authors with few impressions (thresholds of 200 impressions and up to 50,000 followers) that lifts their recent posts, within the first two hours, toward a better position.
    • The 48-hour window. Older posts are filtered out before scoring. On X, a post has two days of life in the For You feed, at most.
    • Diversity reranking. A final step reduces similarity between neighboring posts, so near-identical content competes with itself.

    How to go viral on X, according to the code

    1. Write posts people want to share, not just like

    Sharing via copy link (20) and via DM (5) are among the highest weights. Content that people send to a friend or a group chat travels: useful threads, data, checklists, strong opinions in your niche, things that make someone think of a specific person.

    2. Start conversations

    Replies and quotes are worth about 7.6 likes each. Ask a real question, take a clear position, or leave room for people to add their experience. Replies between mutual followers get an extra boost of 15, so building a network of people who follow each other and talk multiplies reach.

    3. Reply to the people who reply

    Replies from mutuals carry the biggest boost in the parameters, and the 2023 algorithm explicitly rewarded replies that the author engaged with. Answering the first comments keeps the conversation going, and conversation is the strongest positive signal.

    4. Avoid anything that triggers negative feedback

    One report weighs about as much as 355 likes, and a mute or a not-interested click about 80 to 90. Clickbait, engagement bait, aggressive tone, off-topic posts for your audience and repetitive promotion can erase your reach even if some people like them.

    5. Post in your best hours, and do not flood

    With a 48-hour window and a decaying factor for consecutive posts, timing and spacing matter. Post when your audience is active, and space your posts so each one gets its own chance.

    6. Earn follows

    Following the author is worth about 6 likes. Posts that make a stranger want more of you, such as a consistent theme, a clear profile and a series, are rewarded twice: now, and later, because followers see you without the out-of-network discount.

    7. If you are a small account, the first two hours count

    The cold-start parameters suggest that new and small authors get a temporary lift on fresh posts. Put your best content out when you can engage with replies right away.

    What about links?

    Many marketers believe X penalizes posts with links. In the published weights, opening a link is a small positive signal (0.2), and we found no explicit negative weight for links in the parameter file. That does not prove there is no penalty elsewhere: a post with a link may simply earn fewer replies and shares, and other components are not fully public. If you share links, give the post value on its own so people engage before they click.

    What this means for brands and SEOs

    X now works much like modern search: a model predicts the response of each person and ranks content by expected value, not by raw popularity. The skills that win in AI search, useful content, a clear voice, authority and trust, are the same ones that win on X. The difference is speed: on X a post lives for two days, and negative signals act immediately.

    If you publish data or research, X is one of the best channels to get it shared and cited. That is how we distribute our studies.

    Frequently asked questions

    Is the X algorithm really open source?

    X has published the code of its For You recommendation system under an Apache 2.0 license and updates it periodically. Some parts are withheld, and the repository warns that production values may differ from the published defaults.

    What is the most important signal in the X algorithm?

    Among the published positive weights, sharing a post via copy link is the highest, followed by replies between mutual followers, replies, quotes and DM shares. Likes have the lowest positive weight.

    Does posting more often help on X?

    Not linearly. Each additional post from the same author in a viewer’s feed is multiplied by a decaying factor, so flooding gives diminishing returns.

    How long does a post stay in the For You feed?

    The code filters out posts older than 48 hours before ranking.

    Do premium subscriptions affect ranking?

    The published ranking weights do not include a subscription factor, but other parts of the system, such as candidate sourcing, visibility rules and features for subscribers, are not fully described in the parameters we analyzed.