TweetTest

How hashtags work on X

By Tweet Test Team · · 3 min read

A hashtag is the # sign followed by a word or phrase, which X turns into a link to search results for that tag. The idea is simple, but the rules for what counts as part of the tag trip people up all the time. This guide covers those rules, the history behind them, and a few habits that make tags easier to read.

The rules in one sentence

A hashtag on X is a # followed by letters, numbers and underscores, containing at least one letter, and it ends at the first character that is none of those.

That sentence explains almost every surprise.

What can go in a hashtag

  • Letters, from any alphabet. #über, #Москва and #東京 all work. Accented letters are fine.
  • Numbers, anywhere, as long as there is a letter too. #1stDayOfSchool and #R2D2 link.
  • Underscores. #snake_case_ftw and #3D_printing link in full.

What ends a hashtag

Anything else stops the tag. The part before it still links; the rest is plain text.

  • Spaces. #pizza night links only #pizza.
  • Hyphens. #well-done links only #well.
  • Apostrophes. #don't_stop links only #don.
  • Periods, commas, exclamation and question marks. #HelloWorld! links #HelloWorld and leaves the "!" outside, which is usually what you want at the end of a sentence.
  • Ampersands and most symbols. #rock&roll links only #rock. #C++ links only #C.
  • Emoji. #garden🌱 links #garden; the emoji isn't part of the tag.
  • Numbers only. #2026, #007 and #50_50 have no letters, so they stay plain text. Add a word: #2026goals works.
  • A symbol right after the #. #$TSLA isn't a hashtag. $TSLA on its own is a cashtag, a separate feature Twitter added in 2012 for stock symbols.
  • A tag glued to another #. In #no#spaces, nothing links. Put a space between separate tags.

These edge cases match the behavior of twitter-text, the open-source library Twitter published so apps could find hashtags, links and mentions the same way it does.

Readability: CamelCase helps

Because tags can't contain spaces, multi-word tags are written as one run of letters. Capitalizing each word makes a big difference: #latenightcoding versus #LateNightCoding. Search treats them the same, so there's no cost to the capitals.

CamelCase also helps screen readers, which can pronounce the words separately instead of attempting one long word. If accessibility matters to you, and for most accounts it should, capitalize every word in a multi-word tag.

A short history of the

Hashtags weren't Twitter's invention. On August 23, 2007, the designer Chris Messina posted a suggestion: use # for groups, as in #barcamp. The symbol was already used for channel names in IRC chat, which made it a natural fit for people who spent time there.

For almost two years hashtags were a user convention. People typed them and searched for them, but they were ordinary text. On July 2, 2009, Twitter began linking hashtags to search results, and they became an official feature. Trending Topics followed in 2010, and during the 2010 World Cup Twitter showed small flags next to country hashtags, the first "hashflags".

Our Twitter history timeline puts these dates in context.

Using hashtags well

  • Use tags people actually search for. A clever tag nobody else uses is a decoration, not a link to a conversation.
  • Keep it to one or two. A post with six hashtags is hard to read, and X's rules say that adding unrelated or repeated hashtags can get an account filtered from search.
  • Put tags where they read naturally. "Speaking at #DevConf tomorrow" reads better than the same sentence with three tags piled at the end.
  • Remember they cost characters. Every character of a hashtag, including the #, counts toward the 280 limit. See how X counts characters.

Practice

Hashtag or Not gives you ten made-up phrases per round and asks whether X would link the whole thing as one hashtag. After each answer it shows where the tag would stop. A couple of rounds and the rules stick.

Tweet Test is an independent site and is not affiliated with X Corp.

Sources: Hashtag on Wikipedia (Messina's proposal, the July 2009 linking date, Trending Topics, hashflags, cashtags and Twitter's spam warning); twitter-text on GitHub.

Questions

Can hashtags have spaces?

No. A space ends the hashtag. Run the words together, and use capital letters to keep them readable: #LateNightCoding.

Are hashtags case sensitive?

No. #BookClub and #bookclub lead to the same search. Capitals only change how the tag reads.

How many hashtags should I use?

One or two relevant tags is plenty for most posts. X's rules warn that stuffing unrelated or repeated hashtags into posts can get an account filtered from search.

Play Hashtag or Not