Convert to snake_case
Hello World, HelloWorld and hello-world all become hello and world in lowercase, joined by one underscore: 2 words, no spaces. Inner capitals, dots and dashes all count as word breaks. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- Hello World
- Result
- hello_world
- Length
- 11
- Original length
- 11
- Word count
- 2
Empty input is rejected with a clear validation error instead of silently returning an empty string, which protects clients that forgot to bind a form field.
What snake case is and where it is used
Snake case is a way of writing a name with every word in lowercase and a single underscore between words, so Hello World turns into hello and world joined by one underscore. It is the usual style for spreadsheet column headings, database columns, file names and variable names in many programming languages, because it has no spaces and reads clearly. It is not the same as a web address slug, which uses hyphens and drops accents, and it is not plain lowercase, which keeps the spaces. Choosing one style and applying it everywhere avoids the same column appearing under two different names.
How the conversion works and the usual slips
The converter first looks for word breaks hidden inside a name: wherever a lowercase letter or digit meets a capital, a new word begins, and a run of capitals such as XML stays together. Then every run of spaces, hyphens, dots, punctuation or symbols becomes one underscore, the text is lowercased and any underscores left at the start or end are removed. That is why HelloWorld and hello-world give the same result. Typical surprises: accents are kept, digits stay attached to the word next to them, and a text made only of symbols is refused instead of returning nothing.
How the conversion to snake case works
After those structural splits, every run of non-alphanumeric characters—spaces, hyphens, punctuation, symbols—is replaced by a single underscore. The whole string is then lowercased with the host Unicode toLowerCase mapping so accented Latin letters fold correctly without stripping diacritics. Leading and trailing underscores are stripped and internal runs collapse to one underscore, which keeps messy free-text phrases from producing double separators.
Digits stay attached to neighboring word segments unless a letter-digit case edge already forced a split. Empty strings and inputs that contain only separators fail validation before a result is returned. Because the path is pure parse work over strings, latency stays sub-millisecond for typical form sizes and the published cost model is analytic rather than model-token based.
FAQ
What happens if I send empty text?
Empty strings and separator-only input are rejected so clients notice missing fields instead of receiving a silent empty result.
Is this the same as a URL slug?
No. Snake_case uses underscores between lowercased words. URL slugs typically use hyphens and may strip more characters; use a dedicated slug tool for that intent.
What does it cost?
The browser tool is free and runs locally.
How are words with inner capitals, like HelloWorld, split?
A new word starts wherever a lowercase letter or digit is followed by a capital, so HelloWorld splits into hello and world. A run of capitals is kept together, which turns XMLHttp into xml and http rather than single letters.
Are accents removed from letters?
No, accented letters are only lowercased, so Café keeps its é. That is the main difference from a web address slug, which strips accents. If you need plain unaccented text, clean the accents before converting.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/str/snake-case \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hello World"}'const res = await fetch("https://api.kit.forhosting.com/str/snake-case", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "Hello World"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/str/snake-case",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "Hello World"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/str/snake-case", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"Hello World"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"Hello World"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/str/snake-case", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "Hello World"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "str.snake_case",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Snake_case is the standard way many languages and data contracts name variables, columns, and API fields: every word in lower case, separated by a single underscore. This tool takes the phrase or identifier you enter, normalizes separators and camelCase boundaries, lowercases every letter with Unicode-aware mapping, and returns a clean snake_case string plus word count and change metadata. Spaces, hyphens, dots, and other non-alphanumeric characters become separators; HelloWorld and hello-world both become hello_world. No network round-trips inside the engine, no random seeds, and no clock dependence—identical text always produces identical JSON.
How snake_case conversion works
The converter first inserts underscore boundaries at camelCase and PascalCase edges: a lowercase or digit character followed by an uppercase letter splits, and runs of uppercase letters followed by a capital-plus-lowercase sequence split so acronyms such as XMLHttp become xml_http. Extremely long payloads above the documented character cap also fail with invalid_input so a single request cannot monopolize Worker memory.
What you send and what you get back
Numbers and booleans are coerced to their decimal or true/false text forms; objects, arrays, NaN, and Infinity are rejected. If your pipeline later needs pure lowercase without underscores, URL slug hyphens, camelCase, or title case, treat those as separate tools rather than overloading this convert-to-snake-case landing. Send a single required field named text containing the non-empty phrase or identifier you want in snake_case. Aliases such as input, value, data, s, message, string, content, body, and phrase are accepted for convenience when wiring older clients. On success the response echoes the original text, the snake_case result, the result length, the original length, a word_count of underscore-separated segments, a boolean changed flag, and operation set to snake_case. Classic checks include Hello World becoming hello_world, HelloWorld becoming hello_world, kebab-case-name becoming kebab_case_name, and already_snake staying already_snake with changed false when the input was already perfect snake_case. Wire the free browser form for quick paste-and-copy work, then call the identical contract from scripts when you rename CSV headers, generate database columns, or normalize API field names in bulk. Pricing for successful API calls is the published base of $0.002 per item; validation failures including empty text do not consume prepaid balance.
Where snake_case tools show up in real work
Backend and data teams rename human labels from spreadsheets and design docs into stable column and field names before migrations and OpenAPI generation. Mobile and web clients map form labels into request body keys that match server contracts written in snake_case. ETL jobs that ingest mixed CSV headers often force every header through snake_case so joins and schema registries stay consistent across vendors. Product and growth teams paste feature names and experiment labels into a snake_case box before filing them into analytics event dictionaries that assume a single naming style. Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance. Prefer this page when the search intent is literally convert to snake case or snake_case converter; if you need a URL-friendly hyphenated slug, use the dedicated slug tool instead of stretching this capability beyond its contract.
Integration use cases
Normalize API and database field names
Turn human labels and mixed identifiers into stable snake_case keys before migrations, OpenAPI specs, and ORM mappings.
Clean CSV headers for ETL
Force imported spreadsheet headers into snake_case so joins and schema registries match across vendors and runs.
Code generators and scaffolds
Feed phrases into a deterministic snake_case step when scaffolding variables, event names, and config keys.
Technical questions
What does convert to snake_case do?
It lowercases your phrase or identifier and joins words with underscores, splitting camelCase and normalizing spaces, hyphens, and other separators into a single snake_case string.
Does it handle camelCase and kebab-case?
Yes. HelloWorld becomes hello_world, and kebab-case-name becomes kebab_case_name. Acronym-style PascalCase such as XMLHttpRequest becomes xml_http_request.