# Question about max username length

**URL:** https://meta.discourse.org/t/question-about-max-username-length/80022
**Category:** Support
**Created:** [February 7, 2018, 3:18pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022 "2018-02-07T15:18:08Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Philip\_Colmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/philip_colmer/32/120245_2.png) [@Philip\_Colmer](https://meta.discourse.org/u/Philip_Colmer)
#### Post date: [February 7, 2018, 3:18pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/1 "2018-02-07T15:18:08Z")

</div>

In [Usernames on top, lifting username length restrictions](https://meta.discourse.org/t/usernames-on-top-lifting-username-length-restrictions/14747), there is a lengthy discussion about lifting the max username length restriction.

The first post gives an example of the length being increased to 40, but [Usernames on top, lifting username length restrictions - #25 by codinghorror](https://meta.discourse.org/t/usernames-on-top-lifting-username-length-restrictions/14747/25) (post 25) says that it has been officially bumped from 15 to 20.

Is it safe to make it more than 20 characters? The reason I ask is because we’ve tied our Discourse implementation to our LDAP system for SSO, and we’re using the LDAP usernames as the Discourse usernames … and some of our users have got very long names, e.g. moorthy.baskaravenkatraman-sambamoorthy.

What is the maximum length that the system has been tested with? I don’t want to break Discourse by putting in a value that is too high …

Thanks.

---

<div class="post-metadata">

### Author: ![JonnyGamer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonnygamer/32/73086_2.png) [@JonnyGamer](https://meta.discourse.org/u/JonnyGamer)
#### Post date: [February 7, 2018, 4:18pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/2 "2018-02-07T16:18:45Z")

</div>

Great idea, I’ve been wondering about this myself!

Discourse has a maximum length so that other users can easily remember your username. It’s kind of like a shorthand to your actual name.

But I agree, 20 seems a little small

---

<div class="post-metadata">

### Author: ![Philip\_Colmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/philip_colmer/32/120245_2.png) [@Philip\_Colmer](https://meta.discourse.org/u/Philip_Colmer)
#### Post date: [February 7, 2018, 4:21pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/3 "2018-02-07T16:21:14Z")

</div>

@JonnyGamer You make a good point about why Discourse might have a maximum length, although you only need to **start** typing someone’s name and Discourse offers matches. Looking at the linked post, I think that another reason was constraints on the layout but now that full names and usernames are displayed above the post, I hope that is less of an issue than it used to be.

Hopefully one of the devs will be able to chime in 🙂

---

<div class="post-metadata">

### Author: ![Cool\_Cool](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cool_cool/32/86967_2.png) [@Cool\_Cool](https://meta.discourse.org/u/Cool_Cool)
#### Post date: [February 7, 2018, 4:25pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/4 "2018-02-07T16:25:54Z")

</div>

Yeah I agree, maybe closer to 30

---

<div class="post-metadata">

### Author: ![JonnyGamer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonnygamer/32/73086_2.png) [@JonnyGamer](https://meta.discourse.org/u/JonnyGamer)
#### Post date: [February 7, 2018, 6:47pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/5 "2018-02-07T18:47:49Z")

</div>

> [@Philip\_Colmer](#):
>
> start typing

That is very true 👌  
Except trolling people can then make multiple account very easily that are really similar to the long username.

(For exceptionally long usernames, they get truncated, so after a certain amount of letters, you can see after that. Then someone could make multiple accounts, change one character, and it all gets really confusing)

* * *

On the Hopscotch Forum, we are already getting that. Trollers are created account that are the same exact as other users, except the lowercase “L” is an uppercase “i”

llllllllll - L’s  
IIIIIIII - i’s

They are super similar

This is just one example

---

<div class="post-metadata">

### Author: ![PartTimeFemale](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/parttimefemale/32/89023_2.png) [@PartTimeFemale](https://meta.discourse.org/u/PartTimeFemale)
#### Post date: [February 7, 2018, 10:43pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/6 "2018-02-07T22:43:51Z")

</div>

Yeh I once had a conversation on an alt with someone and they thought it was who the alt was impersonating until I told them.

> **""**
>
> Also telling the difference between an alt and a real person can be hard
> 
> ![IMG_0048](https://global.discourse-cdn.com/meta/original/3X/9/f/9fed2e2a72c115b3d49eb2c257ec356fe8740515.PNG)

---

<div class="post-metadata">

### Author: ![memorablechickenyay](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@memorablechickenyay](https://meta.discourse.org/u/memorablechickenyay)
#### Post date: [February 7, 2018, 10:46pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/7 "2018-02-07T22:46:34Z")

</div>

This would be fairly easy to fix wirh a bit of custom css, I would assume. just make the font monospace.

---

<div class="post-metadata">

### Author: ![JonnyGamer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonnygamer/32/73086_2.png) [@JonnyGamer](https://meta.discourse.org/u/JonnyGamer)
#### Post date: [February 7, 2018, 11:11pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/8 "2018-02-07T23:11:48Z")

</div>

Yeah, that makes sense:

```plaintext
III iii
lll LLL
```

---

<div class="post-metadata">

### Author: ![JonnyGamer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonnygamer/32/73086_2.png) [@JonnyGamer](https://meta.discourse.org/u/JonnyGamer)
#### Post date: [February 7, 2018, 11:12pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/9 "2018-02-07T23:12:13Z")

</div>

> [@PartTimeFemale](#):
>
> Yeh I once had a conversation on an alt with someone and they thought it was who the alt was impersonating until I told them.

You mean me 😂

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 7, 2018, 11:14pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/10 "2018-02-07T23:14:20Z")

</div>

> [@Philip\_Colmer](#):
>
> Is it safe to make it more than 20 characters?

As far as I know, it is. You may see some UI breakage with extra long usernames that Discourse does not expect, though. The site setting is

`max username length`

and defaults to 20.

I haven’t checked the database schema to see what the absolute limit on username length as stored in the database is, though.

---

<div class="post-metadata">

### Author: ![Cool\_Cool](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cool_cool/32/86967_2.png) [@Cool\_Cool](https://meta.discourse.org/u/Cool_Cool)
#### Post date: [February 10, 2018, 3:08am UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/11 "2018-02-10T03:08:51Z")

</div>

I, and I am sure some other people, would think that it might be a tire to type out long usernames, even with shortcuts, if there are many similar long usernames, it could take awhile to type

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 15, 2020, 7:14pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/12 "2020-05-15T19:14:59Z")

</div>



---

<div class="post-metadata">

### Author: ![Donavan\_Martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/donavan_martin/32/198936_2.png) [@Donavan\_Martin](https://meta.discourse.org/u/Donavan_Martin)
#### Post date: [November 10, 2020, 4:03pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/13 "2020-11-10T16:03:53Z")

</div>

Looks like username maximum length is 60 characters even if it’s set greater.

I tried with settings of 127 and 254 for username lengths…

Endpoint:

- `https://{{url}}/admin/groups`
- name: `This_is_a_long_username_for_a_new_group_title_that_take_exactly_77_characters`

Response:

```plaintext
{
    "errors": [
        "Name is too long"
    ]
}

```

After verification, this is related to:

> <https://github.com/discourse/discourse/blob/e0d9232259f6fb0f76bca471c4626178665ca24a/app/models/username_validator.rb#L44>

---

<div class="post-metadata">

### Author: ![Donavan\_Martin1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/donavan_martin1/32/243280_2.png) [@Donavan\_Martin1](https://meta.discourse.org/u/Donavan_Martin1)
#### Post date: [February 13, 2022, 4:14pm UTC](https://meta.discourse.org/t/question-about-max-username-length/80022/14 "2022-02-13T16:14:47Z")

</div>

```plaintext
cd /var/discourse/
./launcher enter app
sed -i 's/MAX_CHARS ||= 60/MAX_CHARS ||= 255/g' app/models/username_validator.rb

```
