---
title: "Tell whether a phone number is mobile or landline in C#"
url: https://recursiveai.org/onecontact/cookbook/classify-phone-number-as-mobile-or-landline/
description: "Classify phone numbers as mobile, landline, either, or unknown with OneContact’s offline numbering-plan data. No subscriber lookup is performed."
version: "1.0.0"
---

# Tell whether a phone number is mobile or landline in C#

**OneContact** is a free, open-source contact data library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies, no network access.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneContact) · [GitHub](https://github.com/recursive-ai-oss/onecontact-csharp) · [Docs](https://recursiveai.org/onecontact/docs/) · [Download example (.zip)](https://recursiveai.org/onecontact/cookbook/classify-phone-number-as-mobile-or-landline/classify-phone-number-as-mobile-or-landline.zip)

Parse an international number and read its line type from the region’s numbering plan. This doesn’t look up the subscriber or verify service.

```shell
dotnet add package RecursiveAI.OneContact
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using RecursiveAI.OneContact;

foreach (var input in new[] {
    "+61491570006", "+442079460123" })
    Console.WriteLine(PhoneNumber.Parse(input).Type);
```

[The example](https://recursiveai.org/onecontact/cookbook/classify-phone-number-as-mobile-or-landline/classify-phone-number-as-mobile-or-landline.zip) is the full program below: unzip it and `dotnet run`. To run only the code above, paste it into Program.cs of a new `dotnet new console` project and `dotnet run`.

```text
Mobile
FixedLine
```

## The full program

```csharp
using RecursiveAI.OneContact;

string[] inputs = ["+61491570006", "+442079460123",
    "+12025550123", "+12001230123"];
foreach (string input in inputs)
{
    if (!PhoneNumber.TryParse(input, out var phone))
    {
        Console.WriteLine($"{input}: cannot parse");
        continue;
    }
    string type = phone.Type switch
    {
        PhoneNumberType.Mobile => "mobile",
        PhoneNumberType.FixedLine => "landline",
        PhoneNumberType.FixedLineOrMobile => "either",
        PhoneNumberType.Unknown => "unknown",
        _ => phone.Type.ToString()
    };
    Console.WriteLine($"{input}: {type}");
}
```

`dotnet run` prints:

```text
+61491570006: mobile
+442079460123: landline
+12025550123: either
+12001230123: unknown
```

`TryParse` handles text the parser rejects. A successful parse can still produce `Unknown`, as the last row shows. `either` means the regional numbering plan does not distinguish fixed and mobile for that number; it does not mean OneContact verified both.

## Variations

For a national number, supply the region explicitly. Add these lines to the full program:

```csharp
var local = PhoneNumber.Parse("020 7946 0123",
    Region.Parse("GB"));
Console.WriteLine($"{local.E164}: {local.Type}");
```

```text
+442079460123: FixedLine
```

## Related recipes

- [Parse a phone number](https://recursiveai.org/onecontact/cookbook/parse-phone-number/)
- [Validate a phone number](https://recursiveai.org/onecontact/cookbook/validate-phone-number/)

---

## The short answer

Parse the number and read `PhoneNumber.Type`. `FixedLine` means landline and `Mobile` means mobile in the regional numbering data. Keep `FixedLineOrMobile`, `Unknown`, and any other types as separate results. Don’t turn every non-mobile result into a landline.

## Is there a way to determine if a phone number is a landline or mobile?

Yes, when the numbering plan identifies one type for the number pattern. Pass the complete international form including `+` and the calling code. For local-format input, give the parser the region as in Variations: without it, the parser cannot read a national string as a national number. Use the number’s region, not a server locale that happens to be set on the machine running the code. See the [phone parsing rules](https://recursiveai.org/onecontact/docs/phones/#parsing).

A single number can match a pattern that the plan uses for both fixed and mobile lines. In the full example, `+12025550123` gives `FixedLineOrMobile`. Keep that outcome ambiguous. `Unknown` is different: the input parsed, but the number did not match a known type. This can happen even when the length and calling code allow the string to be parsed. A parse failure, such as missing its calling code when there is no default region, is a separate case again.

## Does phone number validation verify the owner?

No. The library classifies number patterns, not people. `Type` doesn’t query a carrier; it can’t tell you whether a number is assigned, who controls it, or whether a message would be delivered. OneContact’s `IsValid` checks for a known numbering-plan type, so a result can be valid by that test and still be ambiguous between fixed and mobile. The Australian mobile example uses a [number reserved for fiction](https://www.acma.gov.au/use-phone-numbers-fiction).

If the user needs to confirm control of a number, make that a separate verification step in your application. Use this classification for cases where a plan-based result is enough, such as labeling phone fields for review. If a workflow needs definite mobile status, an ambiguous result is not permission to proceed as if the number had been verified.
