Skip to content

Tag: t

Overview

The t tag is used for hashtags in Nostr, allowing content to be categorized, searched, and filtered. It's a fundamental tag for content organization across the entire Nostr ecosystem and is widely used in many different event kinds.

Specification

PropertyValue
Tag Namet
Defined inNIP-24
Required forOptional for most event kinds, recommended for content organization

Format

["t", "<hashtag>"]

Usage Description

The t tag contains a single value parameter: a hashtag string that categorizes the event. According to NIP-24, the value MUST be a lowercase string. This convention ensures consistent searching and filtering of hashtags across clients.

Hashtags can be used for many purposes:

  • Topic categorization (e.g., ["t", "nostr"], ["t", "bitcoin"])
  • Event types (e.g., ["t", "announcement"], ["t", "question"])
  • Content classification (e.g., ["t", "movie"], ["t", "music"])
  • Geographic locations (e.g., ["t", "london"], ["t", "newyork"])
  • Events and conferences (e.g., ["t", "bitcoinconf2023"])
  • Memes and trends (e.g., ["t", "wojak"])

Multiple hashtags can be added by using multiple t tags, not by putting multiple values in a single tag.

Examples

Basic Text Note with Hashtags

json
{
  "kind": 1,
  "content": "Just learned about NIP-24 and how to properly use hashtags in Nostr!",
  "tags": [
    ["t", "nostr"],
    ["t", "nip24"],
    ["t", "learning"]
  ]
}

Calendar Event with Category Hashtags

json
{
  "kind": 31922,
  "content": "Annual Bitcoin conference with workshops and networking",
  "tags": [
    ["d", "5371fe41-2964-4f3e-b203-e56009f54729"],
    ["title", "Bitcoin Conference 2023"],
    ["start", "2023-10-20"],
    ["end", "2023-10-22"],
    ["t", "bitcoin"],
    ["t", "conference"],
    ["t", "blockchain"]
  ]
}

Repository with Topic Tags

json
{
  "kind": 30617,
  "content": "",
  "tags": [
    ["d", "nostr-client"],
    ["name", "Awesome Nostr Client"],
    ["description", "A lightweight Nostr client built with React"],
    ["clone", "https://github.com/user/awesome-nostr-client.git"],
    ["t", "nostr"],
    ["t", "client"],
    ["t", "react"],
    ["t", "opensource"]
  ]
}

Client Behavior

Clients should:

  1. Ensure hashtags are displayed prominently and are clickable/tappable
  2. When a user clicks/taps on a hashtag, show other events with the same hashtag
  3. Provide a way for users to easily add hashtags to their content
  4. Support searching for events by hashtag
  5. Convert uppercase hashtags to lowercase before storing/transmitting
  6. Consider displaying trending or popular hashtags
  7. Allow users to follow specific hashtags
  8. Support muting specific hashtags (via kind:10000 events)

Relay Behavior

Relays should:

  1. Index events by hashtag to support efficient searching and filtering
  2. Support queries that filter by hashtag, allowing efficient discovery of content
  3. Respect case-insensitivity in hashtag searches (though tags themselves should be lowercase)

References

  • d - Often used together with t in replaceable and parameterized replaceable events
  • g - Geographic location, which can complement topic hashtags for location-based events

Notes

  1. While NIP-24 stipulates that hashtag values MUST be lowercase, not all clients enforce this. For maximum compatibility, always use lowercase hashtags in your applications.

  2. Some clients extract hashtags from the content field (words prefixed with #) and automatically add them as t tags to the event. However, this behavior is not standardized and should not be relied upon.

  3. For multi-word hashtags, common conventions include:

    • Using CamelCase: ["t", "bitcoinConference"]
    • Using hyphens: ["t", "bitcoin-conference"]
    • No separators: ["t", "bitcoinconference"]

    The community has not standardized on a single approach, but all client implementations should handle these formats.