Tagging is a common method of creating context relationships between documents. For example, you can apply a "hobby" tag to a woodworking article and a sewing machine PDF manual. You would then find both documents when searching for the "hobby" tag. Used in the Finder and many other applications, DEVONthink also supports tagging in your databases (including optionally preserving Finder tags on imported and indexed items). Tags are either ordinary tags or group tags, each discussed below.

## Ordinary Tags

Similar to tagging methods used in other applications, ordinary tags are added to items by you. Each database has its own Tags group and is accessed in the item list or the Tags section of the Navigate sidebar. The item count of a tag shows how many items it has been applied to. If there are unread items in a tag, the tag's name will appear in bold type. If there is a mixture of read and unread items, the count in the item list will be displayed as "unread items/total items".

Creating tags: When you add a new tag to an item, a tag group is automatically created in the Tags group for the database you're working in. However, you can also create tags to be used later. Create them in the database's Tags using the Data > New > Tag command or the New > Tag command in the context menu or New toolbar button.

Applying tags: When you apply a tag to an item, a reference to that item is created in the appropriate tag group. You will have an item reference in each tag you apply to it. So if you add three tags to a document, you will see a reference to the document in each of the three tags.

Ordinary tags are most commonly manually applied by these methods:

- Type tags into the Tag bar under a document's view/edit pane.
- Type tags into the Tags section of the Info inspector or the Info popover for a document.
- Add tags via the commands in the Data > Tags submenu.
- Add tags via the AI > Tags inspector by double-clicking suggested tags, related tags in the Tags graph, or manually entering them.
- Drag items in your database to the desired tag in the Tags section. Be aware dragging an item to a tag in another database will move it to the receiving database.

You can tag multiple selected items via the Info inspector, Info popover, or the Tag bar.

Note: While importing directly into a tag, e.g., via drag and drop, is supported, it is not generally recommended. If you do this, an item reference is made in the tag but the original item will be located in the Inbox of the receiving database. Importing then tagging is suggested.

Modifying and Merging Tags: You can rename an existing tag in the Tags of a database as simply as renaming any other item. The change will instantly apply to all the items using that tag. If you have similar tags but would like to consolidate them into one, e.g., having tags of `apple` and `Apple`, select them in the Tags group, then choose Tools > Merge n Tags. The tags and their item references will be merged into one tag, preserving the topmost tag's name. Again this change is applied immediately.

A tag can be dragged and dropped into another tag to create parent/child tags. But please read and understand the Nested Tags subsection below before proceeding.

Deleting Tags and Tag Groups: Deleting individual tags from items is done via the same methods you apply them, e.g., in the Generic Info inspector. Deleting tag groups is done in the Tags group of the database. Simply select the unwanted tag and choose Data > Move to Trash. This immediately removes the tag from all them items it was applied to. And only the item references are moved to the Trash, not the original items in the database.

Applying, modifying, or removing tags can also be done by more automated means, e.g., scripting, smart rules, and batch processing. see the Automation chapter for more information.

## Finder Tags

Finder Tags: DEVONthink supports reading and writing macOS' Finder tags. If tags are present on an imported or indexed files, they will be preserved in the database. When tagging imported files, tags are not written to the filesystem. Instead the tags are recorded in the Spotlight metadata when the Create Spotlight Index option is enabled in Database Properties popover. This allows searching for tags in Spotlight using the `tags:myTag` syntax. If you export or drag and drop files to the Finder, macOS tags will be written to the exported file. When tagging indexed files, the tags are immediately written in the filesystem and searchable, just as they would be if you tagged them directly in the Finder.

You can change whether Finder tags should be imported or exported in the Files > Tags settings. Bear in mind these options are global.

## Tagging Sources

Beyond the tag exchange with the Finder, tags can come from several other sources. The following options in DEVONthink's Files > Tags or RSS settings control other tagging mechanisms. Tags from these options can also be manually applied via the Data > Tags submenu and the context menu in the item list.

RSS: In the RSS settings, the Convert categories and hashtags to tags option converts categories detected in the feed articles or hashtags in the contents into tags. In conjunction with the previously mentioned Finder tags or Spotlight data, this can lead to a large number of macOS tags being added automatically in the Finder.

Hashtags: Popularized in social media, hashtags are a type of tag prefixed by a `#`. If enabled in the Tags settings, DEVONthink can detect hashtags in the contents of text-based files and convert them to tags for the file automatically. Removing the hashtags from the content will remove the tags from the file. Hashtags do not support spaces in them and they should be listed on a separate line. They will not be detected within existing paragraphs. Of special note, hashtags supports creating nested tags as noted here. The first tag just needs to be prefixed with the `#` to be detected as a hashtag..

Keywords: When enabled in the Tags preferences, DEVONthink will convert the keywords of PDFs and rich text documents into tags.

Properties: Also found in the Tags preferences, DEVONthink will attempt to convert certain properties to tags, e.g., the names and email addresses of the sender and recipients of emails.

Geolocation: Enable Convert location to tags in the Import preferences to convert the applied geolocation of a file into tags. The Geolocation can be viewed in the Info inspector.

Assign existing tags: DEVONthink attempts to classify the document based on existing tags. If it can't, it examines the contents and title to find words matching tags and applies those it finds.

Add Vision suggestions to images: This option uses Apple's Vision framework to recognize items in images add subject matter tags to the document. These tend to be more generic identifiers.

Pro

Add Chat suggestions to documents: Uses your chosen Chat provider to examine the document and add tags. Optionally, you can have it only apply tags that already exist. These are often more specific, e.g., `snow leopard` versus `feline`.

## Nested Tags

Sometimes referred to as "hierarchical tags", nested tags are a series of related ordinary tags, combined under a parent tag. When you add a child tag, the item automatically inherits the parent tags. In the example shown below, adding a tag of "Casper" to an item would automatically add the "Wyoming" and "US" tags.

A special mechanism in DEVONthink allows you to create nested tags automatically: enter the tags separated by a forward slash. For example, type a tag of `software/productivity` to create a parent tag of `software` with a child tag of `productivity`. Use this option in the places where tags are entered, e.g., the Tags bar, Tags field of the Info inspector and Info popover, and the Tags column in the item list.

Note: If you are having trouble deleting a tag from an item, check to see if you are adding a nested tag.

Caution: Tags for a database can have the same name. This may seem illogical, but it's something more commonly seen that you may expect. For example, say you have a travel database with points of interest like restaurants tagged in different locations. You may find yourself with a tag structure like this…

Example:

    US
        Wyoming
            Casper
                Restaurant
        Minnesota
            St. Paul
                Restaurant

If you added a tag `Restaurant` to an item, what tag would it go to? It actually would go to the most recently entered instance of the `Restaurant` tag.

So how is this resolved? Tags are meant to be unique, so eliminating redundant tags is first priority. Restaurants aren't specific to a geographic location. Create the `Restaurant` tag as a top level tag. If you had a need for hierarchy with the tag, perhaps for tax purposes, you could move it into a parent Tag of `Entertainment`. Then you would get both tags when you added `Restaurant`. But again, if you anticipate wanting to use the tag without the parent tag, you should make it a top level tag.

Also, you shouldn't view the tags as a group structure in and of itself. Nested tags are just meant to group tags specifically related to each other, so they can be applied en masse.

Note: Tagging methods and philosophy is full of strong opinions. Many people feel tagging should always be flat; only top level tags and no hierarchies. DEVONthink accommodates both approaches. However, if you want to used nested tags, we hope you carefully consider the caution we've presented and use a hybrid method to avoid unexpected behavior.

## Group Tags

Previously discussed in the Groups section earlier in this chapter, group tags allow you to dynamically assign tags based on their location. As you add files to a group, they have tags of the parent group's name assigned to them. Similarly, if you move the items to a new group, the tags are removed and new ones applied relative to the new location. Whether used statically or dynamically, group tags can be used creatively. They also work in conjunction with ordinary tags, so you can employ both methods in one database.

Example:

Imagine you have a work database with groups for different stages of a project: Unreviewed, Assigned, In Progress, On Hold, and Done. At the beginning of the process, you'd put the item in the Unreviewed group and it would be tagged as such. After reviewing, you could move the file into the Assigned group and the previous tag would be removed and replaced with Assigned. As the project moves through the staging groups, the tag would change.

And of course you can use ordinary tags, e.g., Reviewed or a client identifier, on these items. Those tags would be preserved no matter where you move them in the databases.

Groups tags are applied by DEVONthink automatically. But you can also do some automatic filing by entering existing group tags manually. If you enter the name of an existing group that is not excluded from tagging into the Tag bar or an Info panel or popover, the item will be replicated to the appropriate group. You can also drag an item to a group tag in the Tag Cloud at the bottom of the Navigate sidebar.

Considerations: When you enable using group tags for a database, it starts as an all-or-nothing situation. All groups in the database function as group tags.

If you want to use group tags for most groups in a database, you can Control-click specific groups and choose Exclude from Tagging. You can also choose this option in the Exclude from… section of the Info inspector or Info popup for a specific group. However, note you must change this setting on all individual groups you'd like to exclude.

If you only want a limited number of tags, it would be advisable to exclude groups from tagging for the database and use ordinary tags instead.

## Autocompletion

When you are typing tags, an autocompletion list will appear. In the Global Inbox, tags from any open databases are shown as potential tags. In other databases, the items displayed are only from the tags of the current database.

While group tags aren't added to the Tags group for a database, they are displayed in autocompletion suggestions.

Tags and Aliases: DEVONthink also honors aliases added to groups. You can add "alternative names" to a group using Info popup or inspector and later use these alternative names as a tag. Continuing the previous example, you could add an alias of `IP` to the `In Progress` group. Now, type `IP` as a tag and it will be replicated to the `In Progress` group. When you view the file, you will see the proper group tag was automatically added.

## Search and Gather

Finally, tags have two main functions: segregating data and searching for data. You use tags to gather items together in certain contexts. You also use tags to search for those items.

Searching for items by their tags is easily done in a few ways:

- Search field: The search field at the top of every main window allows you to search for tags by using the advanced options for a search. You can also search for tags using a simple `tags:` prefix. Multiple tags can be specified, separated by semicolons. You can also use `tags!:` to exclude tags.
- Tag cloud: The Tags Cloud allows you to filter the current list of files by clicking on available tags. As you click, only related tags are shown so you can fine-tune the items displayed in the item list.
- Tags inspector: The Tags inspector not only shows tags on the current document but also existing tags that may apply. Additionally, select a tag and the Tags graph will show other related tags.

Gathering similarly tagged items is powerfully achieved with Smart Groups. Smart groups allow you to use the smart group editor controls to set criteria to be matched. Included and excluded tags can be added as criteria. Files matching the parameters of the smart group are shown, regardless of their location in the database. This way you can leave your files where they are and create virtual folders for specific purposes.