I noticed recently regular users changing usernames (for instance, changing to a username supporting some particular political issue).

The purpose of this post is not to discuss whether this should or not be encouraged.

I'm finding inconvenient not to recognize users I somewhat used to identify. Is there at least a way to track previous usernames of a given user?


2 Answers 2


Let me summarize what was said in commments and in chat.

There are a few related feature requests on Meta Stack Exchange, but my impression is that they are unlikely to get implemented: Make the “past names” list public info for 30 days after changing your name, Keep short history of user display names. (This one is also related, to some extent: Change all @username references in comments when a user changes their name?. Thanks to Federico Poloni for mentioning this post.) From these posts I understand that the moderators can see the past diplaynames. So one solution to see the older usernames would be becoming a moderator - however this is only feasible for small fraction of users.

As Todd Trimble mentioned in a comment, older usernames can appear in past replies directed at that user:

This is hit or miss, but when people ping users in comment threads, the old name after the @ doesn't change. So if you are sufficiently determined, you can try scouring old comment threads.

So if at least one comment reply in the form @username was directed at a particular user while he had some username, the username could be obtained from this.

Comment replies from API

Stack Exchange API has a method to get all comments where the given user was mentioned. From this, usernames used in those comments could be obtained. In fact, there used to be an application on Stack Apps for this purpose: Find old display names of a user.

The link provided in that post is no longer working, but some version can be seen in Wayback Machine here and here.

I have tried to copy-paste the version from Wayback Machine and edit it a bit - and I got some working version here: http://msleziak.com/stackexchange/oldusernames/ (You can also see some screenshots in the linked chat transcript.) I was pleasantly surprised that this works also for deleted users.

I should say that I have no experience with JavaScript whatsoever, so I was basically copying some stuff without really knowing what it does. Probably there are many users around here who would be able to create a much better version from this.

Comment replies using SEDE

I have mentioned also some related posts on Mathematics Meta: To whom am I replying?, List earlier display names for an account and to some extent also Is it possible to know the name of a user with account deleted?.

You can find there some SEDE queries which check replies in posts and comments. Naturally, there will be many false positives. (In some comment which is under my post or follows my comment, people can use @username also to notify somebody else who was involved in the conversation. But there is at least some likelihood that my username might appear in such comments quite often.) This could be useful also if you want username of a user who has deleted their account.

They are far from perfect, but you can try for yourself whether they are useful at least in some cases.

To check for some specific user, simply run this query with that user's id. (The way to find someone's userid is explained in this post on Meta Stack Exchange and this post on Mathematics Meta.) In the case of deleted user, the string user{id} is displayed instead of username, so in that case you can see the id immediately.

(In the above links I have used the OP of this question for the first two queries and quid as an example of deleted user. Maybe some user on MO who often changes their username would be better for testing purposes - but I wasn't able to think of such user.)

Further comments

Whether you're using API or SEDE, you can try both main and meta. As users are typically more active on main than on meta, the results from main will probably be more helpful.

Both solutions basically search in comments for strings starting with @ until the end of the word. End of the word is decided in JavaScript by using regular expression /@\w+\b/, so it ends on the metacharacter \b. In SEDE it is until the next space or characters such as :, , ,. or . (colon, comma or full stop). In practice that means that it won't work on some usernames. For example, since "S. Carnahan" has a dot in his username, you will only get "S" when a comment contains @S.Carnahan.

Another consequence of the way it works is that we get also shortenings of the username which somebody used in a comment reply. For example, if somebody responds to me, both @Martin and @MartinSleziak will work (and I'll get notification about such comments; more details can be found here: How do comment @replies work?). So if somebody used the shorter form, "Martin" will also appear in the list obtained by the above script. (Despite the fact that my username at the time was longer.)

  • 4
    $\begingroup$ Thank you for taking the time to produce this answer. I am very impressed. $\endgroup$
    – S. Carnahan Mod
    Commented Jan 9, 2020 at 12:01
  • $\begingroup$ @S.Carnahan Thanks, but I am not really the person to be praised for this - as I have said in the post, the solution with JavaScript/API was created by somebody else, I have just copied it from the Wayback Machine. (And made some tweaks to get it working.) I am pretty sure that many MO users have very good programming skills, maybe somebody will suggest some possible improvements or make their own version. $\endgroup$ Commented Jan 9, 2020 at 12:05
  • 3
    $\begingroup$ There are some on this forum who craft quality content, using organization, clarity, appropriate level of detail, and focus on topic, with appropriate references. There may be someone on MathOverflow or meta besides Joel Hamkins and Jose Brox who might surpass you in writing with all these elements, but I can't think of who they are. Thank you for making this site even more valuable. Gerhard "Terry Tao Refers To Himself" Paseman, 2020.01.09. $\endgroup$ Commented Jan 9, 2020 at 18:44

In addition to the wonderful work already done by Martin there is one other table in SEDE that holds past DisplayNames of users. The PostHistory table record contains for certain events a JSON blob with the voters in its Text field. The following is an example of that content

{"Voters": [ {"Id":811, "DisplayName": "Shog9"}, { ... } , ... ]}

This are the events (PostHistoryTypeid):

  • 10 Close
  • 11 Reopen
  • 12 Deleted
  • 13 Undeleted
  • 14 Locked
  • 15 Unlocked
  • 19 Protected
  • 20 Unprotected
  • 35 Migrated away

Here is the SEDE query:

;with voters as
Select users.UserId
    , users.UserDisplayName
    , CreationDate
From PostHistory
cross apply openjson(Text, '$.Voters')  -- Gets The Voters array
   with ( UserId int '$.Id'         -- Map Id in the JSOn to UserId
            , UserDisplayName nvarchar(150) '$.DisplayName') users
where posthistorytypeid in (10,11,12,13,14,15,19,20,35)  -- which events are relevant
and Text is not null                                     -- it fails on a null value 
and len(text) > 0                                        -- and on non json
and users.userid = ##userid?1233251##                    -- the one user

select UserDisplayName
     , min(creationdate) [first seen]
     , max(creationdate) [last seen]     
from voters
group by UserDisplayName
order by min(creationdate) desc

Keep in mind SEDE is updated once a week on Sunday.
Use the educational SEDE Tutorial written by the awesome Monica Cellio.
Say "Hi" in SEDE chat.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .