RAG Text Chunker (Markdown to Chunks, Token Counts)
Pricing
from $0.09 / 1,000 chunks
RAG Text Chunker (Markdown to Chunks, Token Counts)
Split Markdown or text into RAG-ready chunks with exact OpenAI token counts (o200k/cl100k): heading-aware, code blocks kept whole, sentence-boundary overlap, heading path on every chunk. Chunks any dataset from Website to Markdown, PDF to Markdown or your own texts.
Pricing
from $0.09 / 1,000 chunks
Rating
0.0
(0)
Developer
Murat Uzun
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
0
Monthly active users
5 days ago
Last modified
Categories
Features
Share
What is RAG Text Chunker?
RAG Text Chunker splits Markdown or plain text into retrieval-ready chunks for vector databases (Pinecone, Qdrant, Weaviate, pgvector, Chroma) and RAG apps, with exact OpenAI token counts (o200k_base for GPT-4o/GPT-5, or cl100k_base for GPT-4 and text-embedding-3). It is heading-aware: every chunk stays inside one section and carries its heading path (Guide > Install > Linux), code blocks are never cut mid-line, oversized paragraphs split at sentence boundaries, tiny fragments are folded into their neighbours, and inline base64 images are dropped. $0.18 per 1,000 chunks on the free plan, down to $0.09 on Gold and above.
Feed it the dataset of a scraping run (Website to Markdown, llms.txt Generator, PDF to Markdown, YouTube transcripts, articles), a list of document URLs (Markdown, text or HTML pages), or paste your own texts, and get one row per chunk ready to embed.
Incremental sync: turn on Only new or changed chunks and re-run on a schedule. Each chunk has a contentHash; the Actor remembers the hashes per document and pushes only chunks whose text changed. Unchanged chunks are not pushed and not charged, and the hashes of chunks that disappeared are listed in the REMOVED_CHUNKS record so you can delete their vectors. When one section of a long page changes, you re-embed that section's chunks, not the whole page.
What does RAG Text Chunker output?
| Field | Description |
|---|---|
documentId, url, title | The source document (documentId is its URL, or document-N) |
chunkIndex, chunkCount, chunkId | Position of the chunk in the document; chunkId = documentId#index |
contentHash | 16 hex characters of SHA-256 of the chunk text; the same text always gives the same hash. Use documentId + contentHash as the vector ID for incremental sync |
headingPath, headings | Headings the chunk sits under, as an array and as A > B > C |
text | The chunk text, with the heading path on top and the overlap from the previous chunk |
tokens, overlapTokens, characters | Exact token count with the chosen tokenizer, tokens of overlap, length |
encoding | o200k_base or cl100k_base |
| any Columns to keep | Fields copied from the source rows, e.g. lang, crawledAt, site |
The OUTPUT record of each run has documents, chunks, chunksPushed, chunksUnchanged, chunksRemoved and errorCode. With incremental sync on, REMOVED_CHUNKS lists {documentId, url, contentHash} for every chunk that is gone since the last run.
How to use RAG Text Chunker
- Give it text: an Input dataset ID from another run (the text column is found automatically), Document URLs, Documents as JSON, or Texts.
- Set Chunk size (default 500 tokens) and Overlap (default 50), and pick the Tokenizer your embedding model uses.
- Run, then embed the
textcolumn of the dataset and store it withchunkId,urlandheadingsas metadata.
Incremental sync with a vector database
- Run once with Only new or changed chunks on and a State store name for your index (for example
docs-index). The first run pushes every chunk. - Upsert the rows with ID
documentId + '#' + contentHash. - Schedule the same input. Each later run pushes only new or changed chunks. Delete the IDs listed in the run's
REMOVED_CHUNKSrecord.
Documents that are not in a run's input are left alone: their hashes stay in the store and nothing is reported as removed.
Chaining with a crawler
Run Website to Markdown or PDF to Markdown Converter, copy the run's dataset ID, and pass it as Input dataset ID. With Apify integrations or the API you can start the chunker automatically when the crawl finishes.
Example input
{"inputDatasetId": "NJMrOuJvOh0X9IP4r","chunkSize": 400,"overlap": 40,"encoding": "o200k_base","keepFields": ["lang"]}
Example output
{"documentId": "https://crawlee.dev/js/docs/3.10/quick-start","url": "https://crawlee.dev/js/docs/3.10/quick-start","title": "Quick Start","chunkIndex": 4,"chunkCount": 26,"chunkId": "https://crawlee.dev/js/docs/3.10/quick-start#4","headingPath": ["Quick Start","Crawling"],"headings": "Quick Start > Crawling","text": "Quick Start > Crawling\n\nYou need to explicitly install it with NPM. 👇\n\n```\nnpm install crawlee puppeteer\n```\n\nRun the following example to perform a recursive crawl of the Crawlee website using the selected crawler.\n\nDon't forget about module imports\n\nTo run ...","tokens": 145,"overlapTokens": 23,"characters": 589,"encoding": "o200k_base"}
In a test on 120 pages of the Crawlee and Apify docs with 400-token chunks and 40-token overlap, the 898 chunks ranged from 23 to 463 tokens (content up to 400, plus heading path and overlap).
How much does it cost?
Pay per result: $0.18 per 1,000 chunks on the free plan, $0.14 on Bronze, $0.115 on Silver and $0.09 on Gold, Platinum and Diamond, plus $0.00005 per run start. In a test with eight long Markdown READMEs (241,000 characters, 300-token chunks) one run wrote 298 chunks, which costs about $0.054 on the free plan. A typical documentation page gives 5 to 10 chunks at 400 tokens. A dataset or URL that cannot be read is listed in the ERRORS record and costs nothing. With incremental sync, unchanged chunks are not pushed and cost nothing: a re-run on unchanged documents costs only the run start. Set Maximum cost per run to cap spend.
Limits
- Chunk size limits the content; the heading path and the overlap are added on top, so a chunk can be up to about chunk size + overlap + the heading path.
- Chunking follows Markdown headings (
#…######). Plain text without headings is split by paragraphs and sentences. - Tokens are counted with OpenAI's tokenizers; other models (Claude, Gemini, open-source embeddings) count somewhat differently.
- Datasets are read in batches of 1,000 rows; very large datasets take longer.
Using RAG Text Chunker with AI agents
The Actor is pay-per-event with limited permissions, so AI agents can call it through Apify's MCP server (mcp.apify.com), for example with {"texts": ["# Doc\n\nLong text..."], "chunkSize": 300}, or with inputDatasetId right after a crawl.
FAQ
Why heading-aware chunks? A chunk that mixes two sections embeds to a blurry vector and is hard to cite. Keeping one section per chunk and putting its heading path in the text makes retrieval and citations more precise.
Which chunk size should I use? 300 to 500 tokens with 10 % overlap is a common starting point for question answering; use larger chunks for summarisation.
Related Actors
Part of the webdatatools web-intelligence suite — every Actor is pay-per-event, reads public data without a login, and returns one clean row per entity:
Browse the whole suite at webdatatools, or call ten of these Actors straight from Claude, Cursor or Cline with the webdatatools MCP server.
Website & domain intelligence
- Email Extractor — Website Contact & Social Finder — e-mails, phones and social profiles per domain
- Tech Stack Detector — Wappalyzer & BuiltWith Alternative — CMS, e-commerce, analytics, pixels and payments per domain
- Domain DNS & Email Security Checker — SPF, DKIM, DMARC, MX provider, registrar and domain age
- Domain Security Audit (TLS, HTTP headers, redirects, robots) — TLS expiry, security headers, redirect chain, robots and llms.txt
- Subdomain Finder (Certificate Transparency) — every subdomain seen in CT logs, with a live DNS check
- Bulk Core Web Vitals & PageSpeed Audit — Lighthouse scores, LCP, CLS, INP and top fixes per URL
- On-Page SEO Audit — title, meta, headings, links, images and schema issues per page
- Sitemap URL Extractor & Change Monitor — every sitemap URL, or new and removed pages between runs
- Wayback Machine Snapshot & Page Change Tracker — how a page changed over time, or every archived snapshot
- Bulk Domain WHOIS & RDAP Lookup — registrar, dates, status and nameservers per domain
- Web Scraper — CSS Selector & Data Extractor — pull any CSS selector off any page, one row per URL
- Website Screenshot Generator — full-page or viewport PNG/JPEG screenshots of any URL
Content for AI, LLMs and RAG
- AI Web Search & Read: Google results as clean Markdown — a query turned into clean Markdown from the top search results
- Website to Markdown — Content Crawler for LLM & RAG — any site as clean Markdown per page, no browser
- llms.txt Generator (Website to llms.txt & llms-full.txt) — llms.txt and llms-full.txt for any website or docs site
- PDF to Markdown Converter (Text, Headings, Metadata) — PDF files to clean Markdown with headings, metadata and token counts
- Article & News Extractor (clean text, author, date, markdown) — clean article text, author, date and Markdown per URL
- Structured Data & JSON-LD Extractor (Schema.org, Open Graph) — Schema.org and Open Graph data from any page
- Google News Scraper (RSS search by keyword, topic, site) — news results by keyword, topic or site
- Press Release Monitor: PR Newswire, BusinessWire, GlobeNewswire — PR Newswire, Business Wire and GlobeNewswire releases
Search, video and social
- YouTube Shorts Scraper — Shorts from channels, hashtags and searches with view counts
- Pinterest Pins Scraper — latest pins of public Pinterest profiles and boards
- YouTube Transcript Scraper — captions and subtitles as text + timed segments, per video or channel
- Google Search Results Scraper — SERP API — organic SERP results per keyword and country
- YouTube Comments Scraper — Comments & Replies — comments and replies with likes, no API key
- YouTube Channel Latest Videos (RSS, no API key) — the latest 15 videos of any channel from RSS
- YouTube Channel Scraper (videos, shorts, live) — a channel's full video, shorts and stream list
- YouTube Search Results Scraper (videos, channels, no API key) — videos, channels and playlists per query
- YouTube Video Details Scraper (views, likes, description, tags) — views, likes, description, tags and chapters per video
- Apple Podcasts Lookup & Episodes Scraper — podcast metadata and episodes from iTunes and RSS
- Bluesky Post, Search & Profile Scraper — posts, profiles, followers and threads from the AT Protocol API
- X Tweet Scraper (Twitter Posts by URL, No Login) — X (Twitter) posts by URL with likes, replies, author, media and MP4 links
- TikTok Profile Scraper (Followers, Likes, Bio, Video Stats) — TikTok profiles with exact follower and like counts, plus video stats
- Telegram Channel Posts Scraper — posts, views and media flags from any public channel
- Substack Publication & Posts Scraper — archive, authors and paywall status per publication
- Google Play Reviews Scraper — reviews, ratings, replies and app versions per app
- App Store Reviews Scraper — iOS reviews and ratings per app and country
- Trustpilot Reviews Scraper (Ratings, Replies, No Login) — Trustpilot reviews with stars, full text, verification and company replies
- Google Trends Scraper — interest over time, by region, and related queries per keyword
- Google Ads Transparency Scraper — ads any advertiser runs on Google, with format and dates
- Keyword Suggestions Scraper (Google, YouTube, Amazon, Bing) — autocomplete keyword ideas from four search engines
- Bilibili Scraper (Videos, Search, Popular) — Chinese video platform: views, likes, coins, danmaku, uploader
- Mastodon Scraper (Hashtags, Accounts, Trending) — public fediverse posts by hashtag, account or trending
- Meetup Events Scraper (Search by Keyword & City) — upcoming events with RSVPs, fees, venues and groups
- Eventbrite Scraper (Events by Keyword & City) — events by keyword and city with venue, dates and organizer
Leads, jobs and company data
- Career Site Jobs API (Greenhouse, Lever, Ashby, Workday +1) — company domains in, their open jobs out, ATS detected automatically
- Workday Jobs Scraper — jobs with full descriptions from any Workday career site
- Google Maps Scraper — businesses with phone, website, address, rating and coordinates per search
- 2GIS Places Scraper (Phones, Websites, Ratings, Hours) — 2GIS businesses in Russia, Kazakhstan, UAE and more with phones, website, rating and hours
- LinkedIn Jobs Scraper — job titles, companies, locations and full descriptions from LinkedIn job search
- Company 360: full company profile from a domain — one row per domain: contacts, tech, security, hiring and company facts
- Hiring Signals Scraper (Greenhouse, Lever, Ashby, Workable) — open jobs and hiring velocity from 10 public ATS boards
- Y Combinator Companies & Founders Scraper — YC startups by batch, industry and hiring status
- Wikidata Entity & Company Enrichment (facts, IDs, links) — HQ, founders, employees, revenue and social IDs per company
- Email Validator & Verifier — Bulk Email Check — syntax, MX, disposable, role and free-provider checks
- OpenStreetMap POI Extractor (Overpass API: shops, amenities) — shops and amenities by radius, bbox or area
- Stock, Crypto & FX Quotes — one row per symbol from Yahoo, Binance and ECB rates
- Yahoo Finance Scraper (Quotes, Fundamentals, Financials, News) — Yahoo Finance fundamentals, analyst targets, financial statements, ownership, news and history per ticker
- DexScreener Scraper (DEX Pairs, Prices, Liquidity, Boosts) — DEX pairs with price, volume, liquidity, FDV and boosted tokens across chains
- Polymarket Scraper (Prediction Markets, Odds, Volume) — Polymarket markets and events with outcome prices, volume and liquidity
- StockTwits Scraper (Messages, Sentiment, Trending) — StockTwits messages with Bullish/Bearish sentiment and trending symbols
- Economic Calendar Scraper (Forex Events, Impact, Forecasts) — This week's macro events with impact, forecast and previous values
- Crypto Fear & Greed Index — Daily Crypto Fear & Greed Index values with full history
- Remote Jobs Aggregator (RemoteOK, WWR, Hacker News) — one clean row per remote job, de-duplicated across feeds
- Greenhouse Jobs Scraper — jobs with descriptions from any Greenhouse job board
- Lever Jobs Scraper — jobs with descriptions from any Lever careers page
- Ashby Jobs Scraper — jobs, salaries and descriptions from any Ashby job board
- SmartRecruiters Jobs Scraper — jobs with descriptions from any SmartRecruiters company
- Seek Jobs Scraper (Australia & New Zealand) — Seek job ads with salary, work type and location
- Dice Jobs Scraper — US tech jobs from Dice with salary and remote flag
- AutoScout24 Scraper — European car listings with price, mileage and seller
- Rightmove Scraper — UK property for sale or rent with price and agent
- Wellfound Jobs Scraper (AngelList Startup Jobs) — startup jobs with salary and equity ranges, company size and stage
- Yandex Maps Scraper (Places, Ratings, Phones) — businesses in Russia, Türkiye and the CIS with phones, ratings, hours
- Craigslist Scraper (Listings, Prices, Locations) — listings in any area and category with price, date and coordinates
- JobStreet Scraper (Malaysia, Singapore, PH, ID + JobsDB) — JobStreet and JobsDB jobs in 6 Asian countries with parsed salaries
- InfoJobs Scraper (Spain Jobs, Salaries, Companies) — Spanish jobs with salary range, contract type and full description
- StepStone Scraper (Germany, Austria, Belgium Jobs) — StepStone jobs in Germany, Austria and Belgium by keyword and city
- Naukri Jobs Scraper (Salary, Skills, Company Rating) — Naukri.com jobs in India with salary range, experience, skills and company rating
- Zillow Scraper (Homes for Sale, Rent & Sold, Zestimates) — Zillow homes for sale, rent or sold with Zestimates, beds, baths and photos
- Zillow Home Details Scraper (Description, Photos, History) — full Zillow property pages: description, photos, HOA, tax rate, agent
- Redfin Scraper (Homes for Sale, Prices, Details) — US homes for sale or sold from any Redfin search, with price and details
- Kleinanzeigen Scraper (Ads, Prices, Locations) — German classifieds with price, VB flag, ZIP, city and seller type
Developer, app and research data
- npm, PyPI & Crates.io Package Health Checker — releases, downloads, deprecation and a health score
- GitHub Repository Health & Activity Report — stars, commits, contributors and risk flags per repo
- VS Code Marketplace Extension Scraper (installs, ratings) — installs, ratings and versions per extension
- Chrome Web Store Extension Scraper (installs, ratings) — users, rating, version and developer per extension
- Google Play Scraper — apps, ratings, installs, developer contact and reviews
- App Store (iOS) App Metadata, Ratings & Top Charts Lookup — ratings, price, version and charts per app
- CrossRef DOI & Citation Metadata Lookup — papers, authors, journals and citation counts
- FDA Recalls & Adverse Events Monitor (openFDA) — food, drug and device recalls from openFDA
- iCal / ICS Calendar Feed to Events Extractor — any public calendar feed as event rows
- Shopify Store Products Scraper — catalog, prices, variants and stock per store
- Hacker News Search & Front Page Scraper — stories, comments and points by query or front page
- GitHub Trending Repositories Scraper — trending repos and developers by language and period
- Stack Overflow & Stack Exchange Q&A Scraper — questions, answers and scores by query, tag or site
- Bulk Image Downloader — download image URLs to storage with size, dimensions and a ZIP
- Google Flights Scraper (Prices, Airlines, Stops) — flight prices, airlines, times, stops and CO2 by route and date
- Google Hotels Scraper (Prices, Ratings, Reviews) — hotel prices per night, stars, rating and reviews by city and dates
- Booking.com Scraper (Hotel Prices, Ratings, Availability) — Booking.com hotels for any city and dates with prices, scores and deals
- Airbnb Scraper (Listings, Prices, Ratings, Coordinates) — Airbnb stays for any city and dates with prices, ratings and coordinates
- AliExpress Scraper (Search Products & Prices) — AliExpress search results with USD price, discount and rank
- Lazada Scraper (Products, Prices, Sold, Ratings) — Lazada products in 6 countries with price, rating, units sold and seller
- Trendyol Scraper (Turkey Products, Prices, Ratings) — Trendyol products with price, basket discount, rating and promotions
Input parameters
| Field | Type | Default | Description |
|---|---|---|---|
inputDatasetId | string | Dataset of another run to chunk, e.g. from Website to Markdown, llms.txt Generator or PDF to Markdown. The text column is found automatically (markdown, `text | |
textField | string | Optional: the dataset column holding the text, if it is not one of the usual names. | |
documents | array | Or paste documents as JSON: [{"url": "...", "title": "...", "text": "..."}]. | |
documentUrls | array | Or URLs of Markdown (.md), text (.txt) or HTML pages. HTML is reduced to its main content and converted to Markdown. Up to 10 MB per document; PDFs are not read. | |
texts | array | Or paste plain texts or Markdown, one document per item. | |
chunkSize | integer | 500 | Maximum tokens of content per chunk (heading path and overlap come on top). |
overlap | integer | 50 | Tokens from the end of the previous chunk repeated at the start of the next, cut at a sentence boundary. 0 for none. |
encoding | string | "o200k_base" | o200k_base: GPT-4o, GPT-4.1, GPT-5, o-series. cl100k_base: GPT-4, GPT-3.5, text-embedding-3. |
respectHeadings | boolean | true | Never mix two sections (headings up to the level below) in one chunk. |
headingLevel | integer | 2 | 2 = split at # and ## headings; 3 also at ###. |
includeHeadingInText | boolean | true | Prefix each chunk with "Title > Section" so the embedding knows the context. |
keepFields | array | Optional: dataset or document fields copied onto every chunk, e.g. lang, crawledAt. | |
onlyChangedChunks | boolean | false | Push only chunks whose text is new since the last run; unchanged chunks are not charged; removed hashes go to REMOVED_CHUNKS. |
stateStoreName | string | "rag-text-chunker-state" | Named key-value store that keeps the chunk hashes. Use one name per vector index. |
Limitations
- Token counts are exact only for
o200k_baseandcl100k_base. Other tokenizers are not supported. - Input is Markdown, plain text or an HTML page. PDFs and Office files are not read; convert them first (for example with PDF to Markdown) and pass the dataset. Pages that need JavaScript to show their text come back nearly empty; crawl them with Website to Markdown and pass the dataset.
- No chunking strategy choice: the splitter is fixed (heading-aware, sentence-boundary overlap).
- Base64 inline images are dropped from the text.
Errors
Failed sources are listed in the ERRORS record (source, errorCode, error) and are not charged. The run's code is in OUTPUT.errorCode.
| Code | Meaning | Run status |
|---|---|---|
NOT_FOUND | A document URL returned HTTP 404 or 410 | SUCCEEDED, other documents are chunked |
INVALID_URL | Not an http(s) URL | SUCCEEDED |
UNSUPPORTED_TYPE | The URL is a PDF, image or other non-text file | SUCCEEDED |
TOO_LARGE | The document is over 10 MB | SUCCEEDED |
EMPTY_DOCUMENT | The page has no text to chunk | SUCCEEDED |
DATASET_READ_FAILED | The input dataset could not be read (wrong ID or no access) | SUCCEEDED |
FETCH_FAILED | Network error, timeout or HTTP 403/5xx from the site | SUCCEEDED if anything else was chunked |
SOURCE_FAILED | No document could be downloaded because of FETCH_FAILED errors | FAILED |
TIME_LIMIT | The run timeout was near; chunks already pushed are kept, the rest is listed | SUCCEEDED |
Run from Python, JavaScript and the CLI
Python (apify-client):
from apify_client import ApifyClientclient = ApifyClient("<APIFY_TOKEN>")run = client.actor("webdatatools/rag-text-chunker").call(run_input={"texts": ["# Guide\n\nSome text to split into chunks."], "chunkSize": 300})for chunk in client.dataset(run["defaultDatasetId"]).iterate_items():print(chunk["chunkIndex"], chunk["tokens"], chunk["headingPath"])
JavaScript (apify-client):
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: '<APIFY_TOKEN>' });const run = await client.actor('webdatatools/rag-text-chunker').call({texts: ['# Guide\n\nSome text to split into chunks.'],chunkSize: 300,});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items.length, items[0].tokens);
Apify CLI:
$apify call webdatatools/rag-text-chunker --input='{"texts":["# Guide\n\nSome text to split into chunks."],"chunkSize":300}'
RAG Text Chunker vs. alternatives
Store pages and price lists read on 29 Nov 2026 (https://apify.com/<id>, pricingInfos of each Actor).
| Actor | Price per 1,000 chunks (free plan → top tier) | Notes from its Store page |
|---|---|---|
| hipersoft/text-splitter-chunker | $0.20 → $0.10 | Recursive or fixed splitting; token count is an estimate (about 4 characters per token) |
| ucchiii/rag-chunker | $0.20 → $0.14 | Reads crawler datasets, heading path; token count is an estimate (characters / 4) |
| shoebill-dev27/rag-text-chunker | $0.20 (one result is one chunk) | Same price on every plan, $0.0005 per run start |
| raional/text-chunker | $0.50 | Recursive, sentence or token strategies, document URLs; $0.005 per GB run start |
| codepoetry/markdown-rag-chunker | $0.80 → $0.60 | PDF, Office and web URLs, stable chunk IDs; Skip if unchanged skips a document only when nothing in it changed, otherwise every chunk of the document is pushed again |
| steady_kahikatea/text-chunker-embeddings | per document plus per chunk | Chunking plus embeddings, a different unit |
This Actor costs $0.18 (free plan) to $0.09 (Gold and above) per 1,000 chunks, the lowest per-chunk price in this table on every plan. It counts tokens with the real OpenAI tokenizers (o200k/cl100k) instead of a characters-divided-by-4 estimate, and it puts the heading path on every chunk. With Only new or changed chunks it pushes just the chunks of a changed document whose text changed and lists the removed chunk hashes; none of the Actors above documents chunk-level change tracking.
Support
Report a document that chunks incorrectly in the Issues tab of this Actor's Store page. Apify platform questions go to https://docs.apify.com.
If the chunker saves you time, please leave a review on its Store page. It helps other RAG builders find it.