Skip to main content

How to Unslugify: Turn a Slug Back Into a Readable Title

A practical guide to unslugify: convert hyphens and underscores back to spaces, fix capitalization, and turn URL slugs into clean Title Case headings.

Published By Li Lei
#unslugify #slug to title #text tools #cms

How to Unslugify: Turn a Slug Back Into a Readable Title

Slugs are great for computers and terrible for people. A URL like /blog/getting-started-with-vue/ is clean, lowercase, and safe to type, but nobody wants to read "getting-started-with-vue" in a navigation menu or a sitemap. At some point you almost always need the reverse trip: take the machine-friendly string apart and put a readable title back together. That reverse trip is what "unslugify" means, and this guide walks through how it works and where it actually saves time.

What unslugify does

Slugifying flattens a phrase. It lowercases everything, strips punctuation, and glues the words together with a single separator so the result is URL-safe. "My First Blog Post" becomes my-first-blog-post. Unslugify runs that pipeline backward. It has to do two concrete things, and getting both right is the whole job:

  1. Hyphens (and their friends) become spaces. Dashes, underscores, and dots are all just word boundaries in disguise. my-blog-post, my_blog_post, and my.blog.post should all split into the same three words.
  2. Words get capitalized. A lowercase run of words is technically readable but looks like a draft. Title Case capitalizes the first letter of each word so the output reads like a heading someone wrote on purpose.

Those two steps cover the common case, but real slugs are messier than a tidy dash-separated string, which is where a dedicated tool earns its keep.

A worked example

Let me run one all the way through. Say you have the slug:

a-beginners-guide-to-rest-apis

Step one swaps every dash for a space, giving a beginners guide to rest apis. Step two capitalizes each word, giving A Beginners Guide To Rest Apis. That is close, but two things still look off. "To" is a small word that headlines usually keep lowercase, and "apis" should read as the acronym "APIs," not "Apis." A good unslugify pass handles the small-word rule and produces:

A Beginners Guide to REST APIs

That final string is the difference between output you can paste straight into an <h1> and output you still have to hand-edit. The small word "to" drops to lowercase because it is not the first word, while "A" at the start stays capitalized. You can do all of this in the browser with the Unslugify tool without writing a regex.

Casing modes you will actually reach for

One slug does not always want the same treatment. The tool gives you four output styles, and each maps to a real situation:

  • Title Case for headings and menu items: My Blog Post.
  • Sentence case for prose, captions, and table cells: My blog post.
  • Lowercase when you want the words separated but flat: my blog post.
  • Raw mode when you only want separators swapped for spaces and your original capitalization left untouched.

Raw mode is the one people misread. It does not split camelCase, because it deliberately leaves your letters alone. If you paste myBlogPost into raw mode you get myBlogPost back. Switch to Title, sentence, or lowercase mode and the camelCase boundaries get split into separate words. That distinction is easy to forget and worth pinning down before you batch a hundred lines.

Handling underscores, dots, and camelCase

Plenty of strings are not URL slugs at all. Database columns use snake_case. Config keys use dots. Code identifiers use camelCase and PascalCase. Unslugify treats all four boundary types at once, so user_first_name, user-first-name, and user.first.name all collapse to the same User First Name. You can even mix them in one string and a-b_c.d splits cleanly into A B C D. Repeated separators like my--blog__post fold into a single space instead of leaving a gap.

CamelCase needs one more rule to be useful: acronyms. A naive splitter turns parseHTMLContent into "Parse H T M L Content," which is worse than the input. The tool inserts a boundary at every lowercase-to-uppercase jump but keeps a run of capitals together as one word, so parseHTMLContent reads Parse HTML Content and parseHTTPResponse reads Parse HTTP Response. That is correct behavior for HTML, API, and URL, not a bug to file.

Where this earns its keep

I built a small docs site last month and exported a list of two hundred URL slugs for the navigation. I had two options: write a one-off script with a capitalization edge case I would inevitably get wrong, or paste the whole column in, leave Title Case and the small-word toggle on, and copy back two hundred clean titles in one click. I picked the second option, finished in under a minute, and the "of" and "the" words came out lowercase exactly the way a person would have typed them. That is the kind of chore that is too small to script and too tedious to do by hand.

The same pattern shows up everywhere once you start noticing it:

  • Auto-generating page titles. A CMS spits out slugs; you need human titles for a sitemap, breadcrumb, or menu. Batch the column through Title Case and you get headings line by line.
  • Building breadcrumbs. The last path segment of a URL is usually a slug. Unslugify it on the fly and your breadcrumb trail reads "Home / Blog / A Beginners Guide to REST APIs" instead of raw slugs.
  • Turning column names into form labels. first_name, date_of_birth, and is_active become First Name, Date of Birth, and Is Active, ready to paste as field labels with no manual underscore surgery.
  • Reading identifiers aloud in a code review. shouldRetryRequest becomes Should Retry Request, which is far easier to say in a meeting and drop into a commit message a non-coder will read later.

If you are going the other direction and need to produce slugs from titles, the slug generator and the case converter cover the forward and casing transforms. Unslugify is the round trip back.

A few things to remember

The small-word toggle only affects Title Case. In sentence, lowercase, and raw modes it does nothing, so flipping it while in sentence case will look broken even though it is working as designed. Switch to Title Case first to watch "of" and "the" change.

And because the input and your style choice are written into the page URL so share links reproduce your exact result, a shared link records that text in the recipient's server log. For anything sensitive, copy the output and paste the text rather than sharing the URL.

Slugs exist to make URLs safe. Unslugify exists to make those same strings readable again when a human needs to see them. It is a small transform, but doing it cleanly across hyphens, underscores, dots, camelCase, acronyms, and small words is exactly the kind of fiddly work a focused tool should own.


Made by Toolora · Updated 2026-06-13