<p>Tags are Elements and are stored in multiple places in the database, so editing the db directly may not be as easy as just finding the Tags you want and deleting them.</p>

<p>The tag itself is stored in multiple places including the tables:</p>

<pre><code>content
elements
elements_sites
tags
</code></pre>

<p>You'll find the Tag Name that you recognize in the <code>content</code> table in the <code>title</code> column. However, the only way to delete the references to a given tag in all of the tables would be to delete it by it's Element ID in the <code>elements</code> table, which would cascade through the other tables and clean them up as well.</p>

<p>Quite possible to do via the db directly, but probably not advisable or convenient in many situations. Be sure to backup your database before you try, if you dare.</p>

<hr>

<p>In the case this must be done manually, you could consider the following steps:</p>

<p>Export all tags from the db into a CSV file. Select all the ones you wish to delete. Use your spreadsheet to combine all the Element IDs of the tags you want to delete into a comma-delimited list. Then return to your database program and delete all the Tags by their Element IDs:</p>

<pre><code>DELETE FROM elements
WHERE id IN (1, 3, 5, 7, 9);
</code></pre>

CC BY-SA 4.0
2018-05-18T01:08:22.427Z
Thanks for the response. 
I'll have a go at looking for them in these places after doing a back up :)

I did see that tag management has been moved to the backlog for Craft 3x so hopefully it does get implemented.
JoelS
CC BY-SA 4.0
2018-05-18T03:18:28.210Z
As it sounds like you're going for it, I've updated the answer with a DELETE query that could come in handy. Maybe consider adding that ticket you found here in the comments so others who find this question could find and upvote it too. Good luck!
Ben Parizek
CC BY-SA 4.0
2018-05-18T00:44:57.217Z
2018-05-18T03:17:01.970Z
2018-05-18T03:17:01.970Z
Ben Parizek
<p>Seeing as there currently isn't a way of deleting / managing tags in Craft3, I was wondering if someone could point me to where in the database these tags are stored so I can delete them manually.</p>

<p>Thanks in advance :)</p>

<hr>

<p>edit:
Looks like tag management through the CMS is also on the agenda for version 3 as seen in this git issue.</p>

<p><a href="https://github.com/craftcms/cms/issues/820" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/820</a></p>

CC BY-SA 4.0
2018-05-20T21:18:28.180Z
[edit] https://github.com/craftcms/cms/issues/820
JoelS
<database><tags>
Where are tags stored in the database?
# Where are tags stored in the database?

(Asked by: username_0 on 2018-05-17)

Seeing as there currently isn't a way of deleting / managing tags in Craft3, I was wondering if someone could point me to where in the database these tags are stored so I can delete them manually.

Thanks in advance :)

---

edit:
Looks like tag management through the CMS is also on the agenda for version 3 as seen in this git issue.

<https://github.com/craftcms/cms/issues/820>

**Tags:** database, tags
> **Comments:**
> **username_0**: [edit] https://github.com/craftcms/cms/issues/820  

---

## 1 answers

### Answer by username_1 on 2018-05-18. Score: 4 | Accepted answer

Tags are Elements and are stored in multiple places in the database, so editing the db directly may not be as easy as just finding the Tags you want and deleting them.
The tag itself is stored in multiple places including the tables:
content
elements
elements_sites
tags

You'll find the Tag Name that you recognize in the content table in the title column. However, the only way to delete the references to a given tag in all of the tables would be to delete it by it's Element ID in the elements table, which would cascade through the other tables and clean them up as well.
Quite possible to do via the db directly, but probably not advisable or convenient in many situations. Be sure to backup your database before you try, if you dare.

In the case this must be done manually, you could consider the following steps:
Export all tags from the db into a CSV file. Select all the ones you wish to delete. Use your spreadsheet to combine all the Element IDs of the tags you want to delete into a comma-delimited list. Then return to your database program and delete all the Tags by their Element IDs:
DELETE FROM elements
WHERE id IN (1, 3, 5, 7, 9);

> **Comments:**
> **username_0**: Thanks for the response.  I'll have a go at looking for them in these places after doing a back up :)  I did see that tag management has been moved to the backlog for Craft 3x so hopefully it does get implemented.  
> **username_1**: As it sounds like you're going for it, I've updated the answer with a DELETE query that could come in handy. Maybe consider adding that ticket you found here in the comments so others who find this question could find and upvote it too. Good luck!  

---

