How to target a feature flag to a cohort in PostHog
Learn how to target a PostHog feature flag to a cohort: open the flag, edit its release condition, add a cohort filter, and save the change.

Quick answer
To target a PostHog feature flag to a cohort, open the flag from the Feature flags list, click Edit, and add a filter to the release condition. Search for the cohort, choose it from the Cohorts results, then click Save. The condition now matches only people in that cohort, at the rollout percentage.
Steps at a glance
- Open the flag from the Feature flags list.
- Click Edit.
- Click Add filter in the release condition.
- Search for and choose your cohort.
- Click Save.
Interactive demo
Summary
A cohort filter limits a feature flag to a saved group of people instead of everyone. Release a feature to one group, such as paying customers, before it reaches the rest of your users.
Step-by-step guide
Step 1
Open the feature flag
Go to Feature flags and find the flag in the list. Click its name to open the flag overview.
Step 2
Click Edit
On the flag page, click Edit at the top. The release condition becomes editable.
Step 3
Add a filter to the release condition
Under the release condition, click Add filter next to the match filters. A search box opens.
Step 4
Choose the cohort
Type part of the cohort name in the search box. Pick the result listed under Cohorts, here Team plan users. The condition now reads as a filter on that cohort.
Step 5
Save the flag
Click Save at the top of the page. The release condition now shows the cohort filter and an updated estimate of how many users it reaches.
Why this matters
You are shipping a new layout and only want one customer group to see it first. Adding a cohort filter to the flag's release condition keeps everyone else on the current experience while you watch how that group responds.
Frequently asked questions
Does the cohort filter replace the rollout percentage?
No. The release condition keeps its rollout percentage, so the flag reaches that share of the people in the cohort.
Do I need to create the cohort first?
Yes. The search only offers cohorts that already exist in the project.
Related guides
Continue with more step-by-step guides for getting work done.
How to create a cohort in PostHogCreate a dynamic cohort in PostHog that groups people by a person property such as plan, so you can reuse the group across insights and analysis.
How to create a feature flag in PostHogCreate a boolean feature flag in PostHog: set a key and description, release it to 100% of users, and save it so your app can toggle the feature.
How to roll out a feature flag to a percentage of users in PostHogLearn how to roll out a PostHog feature flag to a percentage of users: open the flag, click Edit, pick a rollout percentage, and save the change.
How to view person profiles in PostHogOpen a person in PostHog from People and groups, then review their properties and event activity on the profile page's Properties and Events tabs.
How to write a SQL query in PostHogLearn how to write a SQL query in PostHog: enter a query in the SQL editor, run it, and read a table of your most frequent events over 14 days.
How to add an annotation in PostHogLearn how to add an annotation in PostHog: open Annotations, write a note such as a launch, and save it so the date is marked on your charts.
Create interactive demos like this one — free, no coding required.
Start for free →