Skip to main content
Version: 4.0 (next)

Find a Humanizer scenario

Start with the value you already have and the text you need to produce. Humanizer keeps dates, durations, numbers, byte sizes, enums, and collections as typed values until the display boundary; each guide below shows the operation, deterministic culture or clock setup, and failure behavior.

You haveYou wantStart here
An identifier or labelReadable text or another identifier conventionStrings and casing
A noun and countCorrect singular/plural quantity textInflection and quantities
A date, time, or durationRelative, elapsed, fluent, or spoken outputDate and time scenarios
A number or number phraseWords, ordinals, parsing, metric, or Roman outputNumber and data scenarios
An enum or sequenceA readable label or localized listEnum and collection scenarios
A culture-specific ruleExplicit culture or custom behaviorLocalization and extensibility

Example

This smallest example demonstrates the shared rule: set culture explicitly and call Humanizer at the presentation boundary.

Program.cs
using System.Globalization;
using Humanizer;

CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");

var result = TimeSpan.FromMinutes(2).Humanize();

Console.WriteLine(result);
Output
2 minutes

Less common tasks

Keep the typed value

Humanized output is presentation text, not a stable storage or wire format. Keep the original typed value and regenerate text for the active culture. A parser such as TryToNumber or ByteSize.TryParse has an explicit input contract; it does not make arbitrary humanized output round-trip safe.