# How to truncate text?

**URL:** https://community.weweb.io/t/how-to-truncate-text/7323
**Category:** Ask us anything
**Created:** [February 28, 2024, 3:25pm UTC](https://community.weweb.io/t/how-to-truncate-text/7323 "2024-02-28T15:25:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![achambers1997](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@achambers1997](https://community.weweb.io/u/achambers1997)
#### Post date: [February 28, 2024, 3:25pm UTC](https://community.weweb.io/t/how-to-truncate-text/7323/1 "2024-02-28T15:25:41Z")

</div>

Hi all,

I am trying to create this logic:

If text is above 40 characters, truncate to 40 and add an elipses.

So roughly:

“No-code is ready for Enterprises. Join us for an exclusive livestream featuring Matthieu from PwC, one of the biggest auditing companies in the world. Discover how he harnessed the power of WeWeb and Supabase to create game-changing internal apps for PwC and their clients”

Becomes

“No-code is ready for Enterprises. Join us for an exclusive livestream featuring Matthieu from PwC, one of the biggest auditing…”

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/7/723623b75c59b2dc76da26b2b0389a3ae227569e.png)

What’s the right formula to put in? Auto generate AI is crashing.

---

<div class="post-metadata">

### Author: ![niknik39](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@niknik39](https://community.weweb.io/u/niknik39)
#### Post date: [February 29, 2024, 5:34pm UTC](https://community.weweb.io/t/how-to-truncate-text/7323/2 "2024-02-29T17:34:03Z")

</div>

Not sure how to get it to work on a multi-line text, but on a single line field it works as follows:

1. Set No-wrap to ON, then Ellipsis to ON
2. Set the field size and parent div to something other than auto to limit it’s expansion

---

<div class="post-metadata">

### Author: ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)
#### Post date: [February 29, 2024, 6:18pm UTC](https://community.weweb.io/t/how-to-truncate-text/7323/3 "2024-02-29T18:18:01Z")

</div>

Hi both 👋

One option is to use the `subText` formula:

 ![CleanShot 2024-02-29 at 19.16.46@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/4/4eaa3b112fa9eae9bf0d584bb6d7c8aa5cebf1b0.png)

In the example above, I’m saying I want to display the first 4 characters of my text followed by `...`

---

<div class="post-metadata">

### Author: ![Toby007](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@Toby007](https://community.weweb.io/u/Toby007)
#### Post date: [November 24, 2025, 10:23pm UTC](https://community.weweb.io/t/how-to-truncate-text/7323/4 "2025-11-24T22:23:54Z")

</div>

Or this is quite neat:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b8c039c0197aca8a73ca52219ed1368aaa4eeaf6.png)
