# Virtual tags

A virtual tag is a tag key your workspace defines instead of your resources. Its value for each cost line is computed when a report is read: from the provider tag keys you name, then from ordered rules, then from a default. Use one when the same meaning is spread over several keys (`team`, `Team`, `owner`), or when untagged cost still has an obvious owner.

## Before you start

- Open the **Virtual Tags** page at `/virtual-tags` in Costfluent. The page is not listed in the sidebar.
- Creating, editing, previewing and deleting virtual tags needs the Owner or Editor team role in a workspace your team can edit.
- A virtual tag belongs to one workspace, and its key is unique there.

## Create a virtual tag

1. Select **New Virtual Tag**.
2. Enter the **Tag key**, the name reports will show, and optionally a **Description**. Keys starting `k8s:` are reserved for Kubernetes allocation.
3. Under **Provider tag keys**, select the source keys to read, in order. The first key a cost line carries gives its value, so `team` and `Team` can become one tag.
4. Under **Rules**, select **Add rule** for cost lines no provider tag key covered. Give each rule a **Value** and one or more conditions with **Add condition**. A condition uses the same fields and operators as a report filter, except that it cannot read another virtual tag. A rule matches when all of its conditions match.
5. Order the rules with the move up and move down controls on each rule. They are evaluated top to bottom, and the first rule that matches assigns its value.
6. Optionally set a **Default value** for cost nothing matched. Left empty, unmatched cost has no value.
7. Check the **Preview**, then select **Create Virtual Tag**.

## Read the preview

**Preview** shows cost per value over the last 30 days, as a report grouped by this tag would show it. Cost nothing matched appears as "Unmatched", or "Unmatched (reported as …)" when a default value is set. The preview writes nothing, and appears once the key and every rule are complete.

## Use it in reports

In the [explorer](/cost-reports/explore), set **Group by** to Virtual tag and choose the tag under **Tag key**, or add a filter clause on Virtual tag and pick from the values its rules assign. Saved reports, dashboards, share links, CSV exports and the Public API all use the same definition.

## Edit or delete

- Select the edit action on a virtual tag to change it. Edits apply to the next report you open; nothing is recomputed, and past months follow the new definition.
- Select the delete action to remove it. Historical cost data no longer has this tag, and a report that grouped or filtered by it shows "Deleted virtual tag".

## How it behaves

- Order of evaluation for each cost line: provider tag keys in order, then rules top to bottom, then the default value.
- A virtual tag never changes the cost records or your provider tags. It is not an allocation rule; to assign cost to owners, use [segments](/allocation/segments).
- The editor refuses a definition that is larger than a virtual tag allows, with the reason.

## Related

- [Tags and tag coverage](/allocation/tags)
- [Allocation model](/concepts/allocation-model)
- [API reference](/api)
