Instagram export messages and DMs: what you said
How Instagram splits DMs across thread folders and sharded files, and why unsent messages, media and reactions look odd.
Of everything in the archive, the messages section is the one people open first
and read most personally. That is exactly why its file structure is the least
forgiving. A single conversation is not one file. It is a folder of shards, and
reading one shard produces a wrong number that looks right. This post is the
mechanics behind that warning. Where the messages live. How shards merge into one
thread. The strict participant rule that decides what is a DM versus a group.
What a broadcast channel actually is. How unsent, media, shares and reactions are
normalised. And what the app's Messages view does with the whole result. The "who
I actually reached" vocabulary that turns those counts into conclusions lives in
the people-interactions post and the per-contact ratios post. Here the job is the
raw reconstruction, and the rules that keep a chat with a deleted account from
looking like a chat with a mysterious stranger.
You cannot read a thread by reading a single message_*.json file. Instagram
shards one conversation across message_1.json, message_2.json, ... inside
a thread folder. The parser merges shards by conversation_id when present.
When it is missing, the parser derives the thread key from the folder, so
statistics do not fragment.1 Every row is normalised into the sameMessageItem shape: sender, content, timestamp, type, reactions, media URI,
unsent/share flags. Each conversation is then classified by a strict participant
count, never by folder title. A 2-person thread is a DM. Anything with more
distinct people is a group, including zero if no one can be matched. A group
whose messages are one-way from you to a 2+ audience is flagged as an owned
broadcast channel.2
- 2minwhere messages live, and how shards merge into one thread.
- 5minthe classification rules: DM / group / channel, and the edge cases.
- 4mintypes, reactions, unsent, HTML fallback, and the ten conversation states.
Where messages live
Under messages/inbox/ there are per-thread folders. Inside, each shard is
usually message_1.json, and sometimes message_2.json or message_3.json.
HTML variants may also be present.1 Threads you haven't accepted —messages/message_requests/ — are read with the same engine. The parser accepts
any message_\d+\.json path that contains messages. That covers both inbox and
requests, so a pending request is not silently dropped. It simply shows up where
it belongs (see "The request folder" below).1
The thing most people miss on a first look: the folder is the conversation.
The numbered files are just pages of it. Instagram writes a long thread out asmessage_1.json with the newest slice, then message_2.json, thenmessage_3.json and so on, reading backwards in time. If your tool habit is
"open the first file", you are always reading only the latest page.
- Thread folderthe real unit.
- message_1.jsonthe newest slice.
- message_2.jsonolder pages.
- Mergeby conversation id, or folder path.
Sharding: why message_1 and message_2 must be merged
If you read only message_1.json, you will undercount messages for that
conversation. The shared engine accepts any message_\d+\.json in the inbox and
merges them into the same conversation. The merge key is deliberate:1
- If the shard carries a
conversationobject with aconversation_id, thatid is the thread key.
- Otherwise the thread id is derived from the folder path up to the shard
file — so
messages/inbox/0_1name/x/message_1.jsonand itsmessage_2.jsonresolve to the same folder and merge.
The second rule exists for this reason. Instagram's own shards frequently omit
the conversation object. The message_2.json page of a thread often has no
conversation metadata at all. A parser that required the id would see each page
as a new thread. A long chat would fragment into a handful of short ones, with a
consistent, plausible-looking wrong total. Deriving from the folder is what keeps
statistics whole.
The title gets the same care. JSON shards carry a title, and the parser repairs
the text through a mojibake fixer before storing it. Accented names in older
exports arrive mis-decoded. See the how-to-read post for the same repair at the
folder level.3
DMs vs groups: a strict participant rule
Classification is strictly by distinct participants. The rule, quoted from
the source: "exactly 2 participants (you + one other) is a DM; anything with
more distinct people is a group chat — including a thread with ZERO real
participants (none recorded, or only you)."4
In code this is:
- Collapse each name to a trimmed, lower-cased key.
- Drop your own account from the set if it matches the self key, marking
selfFound. - Count the remaining distinct others.
- Zero others → group. A chat with nobody identifiable is not a 1:1 with
anyone, so it must be a group, never a mystery DM.
- One other (or two when self wasn't found) → DM.
- More → group.
Two consequences worth taking in:
- Classification never depends on the folder title. Titles lie or drift:
"0_1name", renamed threads, display names that changed. The participant set is
the ground truth. The owner name is matched case-insensitively, since some
exports repeat you as both username and display name. Duplicates like the
"Instagram User" placeholder collapse too. - The self-matched edge is handled explicitly. Sometimes the owner can't be
matched at all: a missing or empty personal username, or casing drift. The
code then falls back to the raw distinct count,others.size <= 2 → dm. A
2-person thread can never leak into Groups, just because your own name was
written differently than your profile says.
Instagram group chats go up to 250 members. There is no separate "community"
export type, since communities are a Messenger/WhatsApp concept. A 200-person
thread is still just a group here. That is one of the reasons the participant
rule is "anything with more distinct people", with no upper ceiling special-cased.
Owned broadcast channels
LMKFR only flags a thread as isChannel when all of these hold:5
- there are >= 2 other participants (so a real audience, not a DM);
- the thread is one-way from you — you post, nobody else posts;
- you actually sent at least one message.
Subscribed channels you do not own are not flagged as channels. Neither are
one-sided DMs, where someone never replies or ghosts. Both merge into ordinary
group chats. The channel detection comment says why this is safe. Instagram's
export does not include channels you follow. Their own words: "you can't
download things other people share". So anything visible in messages/inbox/
that is one-way from you to a 2+ audience is your own broadcast. The flag is a
recovered semantic, not a guess about ownership. It only fires when the data
itself demonstrates one-way reach.
The view renders the distinction three ways: a conversation badge ("Channel"),
a Channel stat card that only appears when channelCount > 0, and the
channels tab. The label is orange (#f59e0b) versus pink for groups. Channel
threads share the group colour in the conversation-state palette, because the
state maths only makes sense for a two-person chat.67
Unsent messages
When msg.is_unsent is present, the message type becomes unsent andisUnsent is true. The rendered content becomes "Message unsent", so the
presence is visible without inventing its text.8 This is the honest
middle of a classic choice. Instagram's export keeps the is_unsent flag but
does not faithfully keep the body. A reader that tried to rebuild the text would
be writing it for you. Instead the row exists and is counted. It has its
timestamp. It displays exactly the metadata the file actually carries, nothing
more. When you see "Message unsent" in a chat bubble, that is a
removed-before-download message. The app never pretends to know what it said.
Media, shares, reactions
Each message is classified by a shape-based detectType, which refills the
same MessageType union: text, photo, video, audio, link, sticker, gif,
voice, shared_post, shared_reel, shared_story, unsent, other.2 The
detection order matters, and it is the source of truth:8
| Shape in the raw record | Becomes | Rendered as |
|---|---|---|
| `is_unsent: true` | `unsent` | "Message unsent" |
| `stickers[]` | `sticker` | "Sticker" |
| `gifs[]` | `gif` | "GIF" |
| `audio_files[]` | `voice` | "Voice message" |
| `photos[]` | `photo` | "📷 Photo" |
| `videos[]` / `clips[]` | `video` | "🎬 Video" |
| `audio[]` | `audio` | "🎵 Audio" |
| `share:{reel_share}` or text matching `/reel/i` | `shared_reel` | share text or "Shared reel" |
| `share:{story_share}` or text matching `/story/i` | `shared_story` | share text or "Shared story" |
| `share:{link/share_text}` | `shared_post` | share text/link or "Shared post" |
| `content` | `text` | the content |
| anything else | `other` | empty |
Three details make this table trustworthy:
- Shares are typed by shape keywords, not by folder. A shared reel is a
share.reel_share, or share text containing "reel". A story works the same
way. A generic link share is a shared post. TheshareUrlis extracted fromshare.linkwhen present, so a shared post is both typed and deep-linked. - Media URIs are kept, not embedded.
mediaUripoints at the file insidethe archive:
photos[0].uri,videos[0].uri, sticker/GIF/voice URIs. That
lets the Stories/Content side resolve the actual bytes, without reading more
of the message row than necessary. - Everything passes through the mojibake repairer. Sender names, content,
share text, reactions and actors. Non-Latin names are exactly what breaks in
older exports.
Reactions are normalised so visually-identical emojis group together. The
rule in code: strip the U+FE0F variation selector, and NFC-normalize. (❤ vs ❤️
are the same reaction on Instagram.) ZWJ sequences, keycaps and skin-tone
modifiers are preserved on purpose, because they are distinct reactions.groupReactions then aggregates raw strings by canonical form, keeping the
first-seen spelling for display. It rolls up count and the list of actors
for each emoji.9 So a photo with ❤️ from two people renders once, as❤ ×2, with both names attached. It does not render as two rows that look
identical but never add up.
Bubbles that are not words
Some bubbles carry no text at all. The export kept a sender and a time, but no
body and no attachment. They are counted as bubbles, and shown in their place in
the thread. A note says why they look empty. Nothing is written into the gap.
Hidden or removed attachments are listed apart from plain blanks.
Standalone reaction notices are reactions too. A "Liked a message" bubble is
shown as a reaction. It is not folded into the message count, the word count or
the media count. Reaction emoji are grouped by shape, so two spellings of one
heart add up once.
Shared stories, reels and links get their own cards. A story card can show the
local preview and the recorded expiry. A link card shows the domain it came
from. These are kinds of message, not words you typed. The same split runs
through the whole Messages view.
AI chats are kept out of all of it. Meta AI and AI-character threads live in
their own tab. Their bodies can be read there, but they never enter your human
DMs, groups, people counts or totals. An AI reply is labelled as AI even when the
file stored it under your own name.
AI chats are not people
explains the split. Once the kinds are clear,
local search can find
one line without turning it into a person count.
The request folder: a different social weight
Threads under messages/message_requests/ are parsed with the same engine
and land in the same conversation list. This is a deliberate trust choice.
A message you never accepted is still a message in the archive. Hiding it would
silently change every "who reached me" total. It is shown plainly, as part of
the archive. The people-interactions post and the who-got-your-words post both
keep the "request vs accepted" distinction when turning counts into conclusions.
The parser does not invent a marker for the folder. It treats the incoming
message as what it is: a message. If you would rather not relive an old request
thread, that is a display choice you make locally. None of it leaves your machine.
HTML fallback
The HTML parser (message_\d+\.html) rebuilds a minimal conversation
structure. It derives the thread id from the folder. It extracts
sender/timestamp and text/type from the HTML table rows. Some fields are simpler
or absent compared to the JSON path, such as precise share URLs and
reactions.1 The row reading rules are worth knowing. Header rows andcolspan layout rows are skipped. Each data row needs at least three cells.
The sender comes from cell one, and the content (or an image/link) from cell two.
The timestamp is found by scanning the remaining cells for the first parseable
time. Media in HTML rows is detected from the presence of an img or a
media-path a[href]. It is typed photo/video the same way the JSON path types
it. So the two formats end up with the same message vocabulary, even though HTML
can't carry the structured share/reaction objects.
What the Messages view does with the whole result
The header states the totals plainly: "N messages across M conversations."
Four stat cards plus totals drive the tabs. DMs. Groups, which are group
chats excluding channels, so the two never double-count. Channels, only
shown when you own at least one. People, the distinct contacts. And
Total.6 Below that:
- Message types donut — every type in the table above, with per-type
labels and colours. So "how much of my history was voice notes" is a
slice, not a guess. - Overall split — a you/they ratio bar over the whole archive, and the
same split per conversation (the two-sided bar with "You: N / Them: N").
- Per-DM detail — for each 1:1, the top-contacts list is computed from
the DM stats: name + messages + media, sorted by message count. Group
cards show group activity: chats you're active in, your share of group
messages as a percentage, average messages per group, and the owned-channel
card ("You own N broadcast channels, posting M messages").6 - In-thread tools — sender filter, media-only filter, type filter, and a
plain-text search across the open thread. Long threads reveal in chunks of
up to 250, with an initial window of 60. That keeps a 10,000-message chat
usable, instead of rendering one massive tree.6
- HeaderN messages across M conversations.
- Stat cardsDMs, Groups, Channels, People, Total.
- Message types donutone slice per message type.
- In-thread toolssender, media-only, type, search.
Every one of these numbers is derived downstream of the merge described in
this post. That is why the merge is the load-bearing step. Count a fragment, and
the donut, split and top-contacts are all wrong with a straight face.
Conversation states: the colour a chat gets
For two-person chats the app assigns each conversation one of ten states.
Each has a definition string and a colour. The list is in the order the code
checks them, first match wins:7
| State | Definition | Colour psychology |
|---|---|---|
| You never replied | They wrote and you never answered once | rose — gone cold |
| They only ever message you | Every message is theirs | amber — waiting on them |
| You only ever message them | Every message is yours | teal — you in control |
| One message only | A single message ever exchanged | lime |
| Big conversation | 200+ messages — one of your heaviest | violet — your reach |
| Gone quiet | Nothing for 90+ days either direction | rose |
| Media only | No typed words at all | cyan |
| They spoke last | Newest message is theirs — ball is with you | yellow |
| You spoke last | Newest message is yours — you have the last word | green |
| Engaged both ways | Neither side is one-way | violet |
The state is computed from the merged thread. The self key is established from
the profile file. The code then counts you vs them, whether any typed content
exists, the newest timestamp, and who sent it. Groups and channels share one
grey colour, because the state maths only makes sense for two people.7
Keep one caveat next to it. dormant uses a 90-day window against your
archive's latest timestamp. If your export is old, "now" in the code is your
export's newest message. So "Gone quiet" is measured from your data's end, not
the calendar. The who-got-your-words post treats that window with its own longer
ghost/dead thresholds for the ratio view.
The self key: who "you" is in every split
Every you/they number in this section depends on a single predicate: which
sender name in the records is you. That covers the overall ratio, the
per-conversation bars, "you sent", and one-way states. The predicate is built
once, from the profile file, as the self-key set: override → username →
fullName, each normalised and deduplicated. It includes the optional manual
override for anonymised exports (the personal-information post documents where
those keys come from). The messages view then marks a row yours when its sender
normalises to that set. Anything else is "them".10
Three consequences are worth holding in mind as you read the numbers:
- A mismatched self key flips direction everywhere at once. Your own name
may appear in the records with different casing, or an accent written two
ways. The merge still recognises it, because every name is normalised before
comparison on both sides. Sender rows and self key are reduced the same
way before matching, so "Ayla" and "ayla" and "AYLA" all hit.4 - The placeholder is deliberately not "you". "Instagram user" is not
matched as self. A deleted-account thread cannot inject a fake
self-count. It stays a them-count with no identity, which is exactly what
the record says. - Your export's own wording wins. Override aside, the self set is
whatever the archive itself recorded: the account's own stated name and
handle. An export may strip or anonymise those. The override exists to
restore the split. It is stored locally and never leaves the machine.
This is the same identity anchor the whole activity taxonomy's yours flag
hangs on. That is why the two sections never disagree about who you are: they
share the one self-key builder. This post's job is to say where it comes from.
The person-in-your-archive post explores what it means that the whole product's
"you" is two strings in a profile file, plus an optional local correction.
How to read it honestly
The rules that keep the numbers honest, in the order they bite:
- Merge, do not cherry-pick. If a thread has
message_2.json, includeit. The folder is the conversation; the numbered files are pages of it.
- **DM/group classification comes from participant distinctness, not folder
title.** "0_1name" is a folder, not a person. A chat with nobody
identifiable is a group, never a mystery DM. - The channel flag requires one-way reach from you to a >=2 audience —
subscribed channels and one-sided DMs are ordinary groups.
- **An "unsent" row was removed before download — there is no reconstructed
body.** "Message unsent" is the full honest truth of that row.
- Reaction counts are grouped by canonical emoji (U+FE0F stripped, NFC
normalised) while skin-tone and ZWJ variants stay separate — a "❤" you
saw in two spellings is one reaction; a "👍🏽" is not the same as "👍". - Attribution is exactly as strong as the sender label the file carried —
"Instagram user" is the placeholder left by a deleted account (see FAQ),
and no view fills it in. - The request folder is part of the archive. Threads you never accepted
are messages too, and they count. The "who reached me" posts keep the
accepted/requested distinction when drawing conclusions. - A per-person count from these files is arithmetic, not judgement. The
people-interactions post says it as the section's whole point: per-person
totals are sums of rows, and the states above are descriptions of
direction, not verdicts about the relationship.
The thread is the unit, not the file.
Why does a message show the sender as 'Instagram user'?
It is the label left behind by a deleted account. When the account that sent a
DM was removed, Instagram replaced that account's name in the record with a
placeholder. The message body, timestamp and thread are all still there. Only
the sender identity is gone. We render the exact label the record carries,
rather than inventing the name, because the record no longer holds it.
Why do I only see part of a long DM when I open one file?
Because the conversation is sharded across message_1.json, message_2.json,
etc. All shards for that thread must be merged to get the full count. The
parser merges by conversation_id when present, otherwise by folder path up
to the shard.
How does the app tell DM from group chat?
It counts distinct participants, excluding yourself. If there is more than 1
other, it is a group. A DM happens only when others <= 1 after accounting for
self. Casing drift is tolerated. A chat with nobody identifiable is always a
group, never a mystery DM.
What are unsent messages?
Messages recorded as unsent. The export keeps is_unsent; the text is not
reliably recoverable, so it is rendered as "Message unsent" — visible and
counted, never invented.
Are owned broadcast channels always flagged?
Only when you are the sole sender to >= 2 others and sent at least once.
One-sided DMs and channels you subscribe to are not flagged as channels.
Why does each emoji reaction get a different count from what I remember sending?
Reactions are grouped by canonical form. The U+FE0F variation selector is
stripped and the string NFC-normalised, so ❤ and ❤️ are one reaction. ZWJ
sequences, keycaps and skin-tone modifiers are kept distinct. What you
remember as "one heart" is usually several recorded spellings of the same
emoji. The app unifies them on purpose.
My accent names look mangled in older exports — is that a bug?
Older exports often store non-Latin names as Latin-1-mangled octets. The
parser runs every sender, content and share string through a mojibake
repairer before storing. It repairs the thread title too. If a name still
looks off, it is the raw value the file carried. The repair is best-effort by
design, never a rewrite.
Does the channel that I follow show up in my export?
No. Instagram does not include channels you follow ("you can't download
things other people share"), so every channel-flagged thread in your archive
is one you broadcast to a 2+ audience. That is why the flag only fires for
sole-sender threads.
Why is a DM I never answered listed as a 'conversation' at all?
Because it is a thread folder in your archive with messages in it. The state
maths then names it honestly, as "You never replied" or "They only ever message
you", rather than hiding it. Your archive records what was sent to you.
Deciding whether that is meaningful contact is the reading layer in the
people post, not the file layer.
How are media-only threads separated from text ones?
By a simple rule in the state classifier. If no message in the merged thread
has typed content, it is media-only. Photos, reels, stickers, GIFs and
voice notes all count as media rows. So a chat of nothing but voice notes is
honestly labelled "Media only — no typed words at all", instead of quietly
blending into text history. The per-type donut lets you see the same split
for the whole archive: voice, photos, shares, and how many rows were text.
Questions this comes up
The people-interactions post for the vocabulary that turns message counts
into "who I reached". The who-got-your-words post for the three ratios and
the per-contact status layer built on these same threads. The content post
for DM media and the watch-history files this section also touches. The
relationships post for the follower/who-follows lists a chat partner may or
may not also be listed in. The how-to-read post for the mojibake repair that
this section applies to every string.
Still reading file-by-file? Re-read the "merge, do not cherry-pick" rule, and
remember the unit: the thread.
Footnotes
For developers — source references
Pointers into the open-source code that implements the behaviour described above.
packages/shared/src/parsers/messages.ts—parseJSON(L283-323):
shard regexmessage_\d+\.jsonwith amessages/inbox/fast-path plus a
genericmessagesguard (L287-288) somessage_requests/feeds the same
engine; thread id =conversation.conversation_idwhen present, else folder
path up to the shard (L300-304); title mojibake-repaired (L305); folder
derivation comment (L297-299).parseHTML(L325-385):message_\d+\.html
(L329), folder-derived thread id (L338-342), table-row reading that skipsth
andcolspanrows (L346-348), sender cell 1 / content cell 2 / first
parseable timestamp in later cells (L351-359), media typed fromimgor
media-patha[href](extractHTMLContentL237-252), participants collected
from observed senders (L381).↩packages/shared/src/types/messages.ts—MessageItem(sender, content, timestamp, type, reactions, mediaUri, isUnsent, shareUrl, L8-17);Conversation(title, participants, messages, messageCount, mediaCount, type, isChannel?, channelOwner?, L21-34);MessageTypeunion (L6);ConversationType = 'dm' | 'group'(L19);MessageReaction(L1-4).↩packages/shared/src/parsers/text-repair.ts—repairLatin1Mojibake
applied at parse and again infinalizethreads; also linked from the
how-to-read post's folder-level treatment.↩parsers/messages.ts—classifyType(L21-36) with the strong
rule comment (L7-20): zero others → group;others.size <= (selfFound ? 1 : 2) → dm; owner matched case-insensitively; "Instagram User" placeholder
collapses; 250-member groups have no separate community type.↩parsers/messages.ts—detectOwnedChannel(L47-65): >=2 others,
sole sender must be self, at least one self-sent message; the "you can't
download things other people share" quote with subscribed channels excluded.↩apps/web-next/src/views/Messages.tsx— header "N messages across M
conversations" (L1089); DMs/Groups/Channels/People/Total cards (L1097-1103,
Channels shown only whenchannelCount > 0L1099); Message-types donut
(L1108-1115); Overall splitSentRatio(L1119); per-DM top-contacts
(L375-389), group activity card L392-398, channels card L407; in-thread
sender/media/type filters + chat search (L132-140); chunk revealMSG_CHUNK = 250/MSG_INITIAL = 60(L109-110); tab labels with tips
(L63-64).↩packages/shared/src/analytics/conv-states.ts—CONV_STATES(L26-37) with per-statedesc; first-match-wins ordering
comment (L4);classifyConversation(L70-105):one-way-them,one-way-me,single-message,dormantatDORMANT_DAYS = 90(L52),media-only, "big
conversation" atHIGH_VOLUME = 200(L53), last-theirs/last-mine, engaged;
groups/channels shareGROUP_CONV_COLOR(L49) — "state maths only makes
sense for a two-person chat" (L47-48);isDirectConversation(L59-63).↩parsers/messages.ts—detectType(L95-113) shape-order table,extractContent(L115-131, including "Message unsent" L121),extractMediaUri(L133-140),extractShareUrl(L142-147),normalizeMessage(L149-165) with mojibake repair on every string field.↩parsers/messages.ts—normalizeReactionEmoji(L73-76: NFC +
U+FE0F strip, ZWJ/keycap/skin-tone preserved) andgroupReactions(L79-93:
canonical grouping, first spelling kept, count + actor rollup).↩packages/shared/src/analytics/you-persona.ts:248-258—youSelfKeys(override, username, fullName), each normalised and deduplicated;
the messages view —youSent/theySentviasender === self;:941and the view's stats derivations refilter by the
same self; the override is stored inlocalStorage(YouPersona.tsx:261-264),
locally and never transmitted.↩