How to Get LinkedIn Username from URL — Quick Guide

How to Get LinkedIn Username from URL — Quick Guide

How to Get LinkedIn Username from URL — Exact Steps for Professionals

Need to extract a LinkedIn username quickly and reliably? Whether you're building a content calendar, automating outreach correctly, or preparing personalized posts with an AI tool, knowing how to get LinkedIn username from URL is a small technical skill with big impact. In this guide you'll find practical methods (manual, regex, devtools, API), privacy best practices, troubleshooting tips, and an automation option that saves hours every week.

Who this is for: solopreneurs, founders, marketers, B2B sales pros, and anybody using automation or personal-brand tools on LinkedIn.

Quick answer (featured snippet optimized)

If the profile URL is public, the username usually follows /in/. Extract it by copying the URL and taking the text after /in/ until the next slash or question mark. Example: https://www.linkedin.com/in/jane-doe-12345 → username = jane-doe-12345.

Why extract the LinkedIn username?

  • Personalization: tailor AI-generated posts to a user's public handle or vanity name.
  • Data joining: combine profile URLs with CRM records or content calendars.
  • Automation: feed correct identifiers into schedulers or analytics tools.
  • Verification: confirm the exact public name when multiple similar profiles exist.

6 reliable ways to get the LinkedIn username from a URL

Below are step-by-step methods ordered from fastest/manual to robust/automated. Use the one that matches your workflow and compliance requirements.

Method 1 — Manual copy (fastest)

  1. Open the LinkedIn profile in your browser.
  2. Look at the address bar. Typical public profiles use /in/ or /pub/.
  3. Copy the segment after /in/ until the next slash (/) or question mark (?).

Example: https://www.linkedin.com/in/charles-smith-7890/ → username = charles-smith-7890.

Method 2 — Use a simple regex or text split (great for spreadsheets and scripts)

If you're processing many URLs, use a short regex or split function in Excel/Sheets or your script. Example regex (PCRE-style):

^(?:https?:\/\/)?(?:www\.)?linkedin\.com\/in\/([^\/?#]+)

In Google Sheets you can use:

=REGEXEXTRACT(A2, "linkedin\.com\/in\/([^\/?#]+)")

This returns the vanity name or public identifier directly. If your data contains /pub/ or mobile URLs, expand the pattern accordingly.

Method 3 — Browser devtools / page source (when URL hides the vanity name)

  1. Open the profile and press Ctrl+U (view source) or open DevTools (F12).
  2. Search (Ctrl+F) for "@type":"Person" or application/ld+json. LinkedIn often includes structured data like JSON-LD with the public identifier.
  3. Look for "alternateName" or URL fields that include the vanity string.

Use this when the visible URL is a redirect or the site uses obfuscated links.

Method 4 — Mobile and share links

Mobile and share links sometimes contain the public identifier. Example patterns you might see:

  • https://www.linkedin.com/in/username
  • https://www.linkedin.com/in/username?trk=public_profile
  • https://www.linkedin.com/sales/people/urn:li:fs_miniProfile:ACoAAC...' (useful for Sales Navigator; identifier differs)

When you see an urn:li string, that is LinkedIn's internal ID — not the vanity username. Decide whether you need the public handle or the internal URN for your use case.

Method 5 — LinkedIn API and developer routes (robust, but requires permissions)

If you're programmatically resolving usernames at scale, use LinkedIn's API. Note:

  • LinkedIn's APIs require developer registration and proper permissions. See LinkedIn docs for up-to-date rules: LinkedIn Developer Docs.
  • APIs can return structured profile fields, including public profile URL and identifiers; respect rate limits and privacy rules.

Use the API route only if you're authorized to access the profile data or have the user's consent.

Method 6 — Third-party tools and automation platforms

Some tools and automation platforms (including Linkesy) simplify profile connection and content personalization. Benefits:

  • Automated fetching of public profile details after an authorized connection.
  • Safe, OAuth-based authentication—no password scraping.
  • Integrations with content calendars so you can schedule personalized posts using a verified handle.

If you use a tool, confirm how it stores identifiers and that it follows LinkedIn's terms.

Common URL patterns and how to read them

Pattern Meaning
/in/username Public vanity profile — username is human-readable and preferred for personalization.
/pub/username/123/45/6 Older public URL format with numeric path segments — username still present.
urn:li:person:ACoA... Internal LinkedIn ID (not a public vanity name). Useful for API lookups but not for display.

Regex and script examples (copy-paste friendly)

JavaScript (node/browser):

function extractLinkedInUsername(url){const m = url.match(/linkedin\.com\/(?:in|pub)\/([^\/?#]+)/i);return m?m[1]:null;}

Python (simple):

import re m = re.search(r"linkedin\.com\/(?:in|pub)\/([^\/?#]+)", url) username = m.group(1) if m else None

Privacy, compliance, and LinkedIn's Terms of Service

Before extracting and storing usernames at scale, consider:

  • Consent: only process profile data when you have a legitimate purpose or user consent.
  • Rate limits and scraping rules: scraping pages repeatedly can violate LinkedIn's terms — use official APIs when available.
  • Data protection: store identifiers securely and purge them when they’re no longer needed (GDPR/CAL-Privacy best practices).
Tip: For marketing and content personalization, connect accounts via OAuth whenever possible — it's safer and more reliable than scraping.

When to use the public username vs LinkedIn internal ID

  • Public username — use for display, mentions, and personalization in posts.
  • Internal URN — use with Sales Navigator or API calls that require the internal ID.

Automating extraction at scale: tools and best practices

Automate safely:

  1. Prefer OAuth-based connectors over scraping.
  2. Cache usernames with timestamps and re-validate periodically.
  3. Log API usage and respect rate limits to avoid throttling.

For content teams, Linkesy automates LinkedIn content creation and scheduling after you connect your account via OAuth—so you don't need to manually extract or maintain vanity names for every profile. Learn how Linkesy's autopilot can free 5–10+ hours/week: Try Linkesy free or See our plans.

Comparison: manual vs script vs API vs Linkesy

Method Speed Accuracy Compliance / Best for
Manual copy Fast (single) High Small scale, non-sensitive tasks
Regex / scripts Fast (batch) High for public URLs Medium-scale workflows
LinkedIn API Automated High Enterprise, authorized apps
Linkesy (OAuth) Automated High Content automation, scheduling, personal-brand teams

Checklist: before you extract usernames

  • Do you have permission or legitimate interest?
  • Will you store the username securely?
  • Is the identifier public (vanity) or an internal URN?
  • Do you have an API key or OAuth connection for frequent lookups?

Resources and further reading

Frequently asked questions

How do I find a LinkedIn username from a URL?

Open the profile URL and copy the text after /in/ until the next slash or question mark. Use a regex like linkedin\.com\/in\/([^\/?#]+) to automate.

Is the LinkedIn username different from the internal ID?

Yes. The public username (vanity) appears after /in/. LinkedIn also uses internal URNs (e.g., urn:li:person:...) for APIs; those are not suitable for public display.

Can I extract usernames with a script without violating LinkedIn's terms?

Automate with care. Use official APIs and OAuth for large-scale or frequent access. Scraping public pages repeatedly can violate LinkedIn's terms and result in rate limits or bans.

What if the URL is a redirect or uses Sales Navigator URNs?

Inspect the page source for structured data or use the API. For Sales Navigator, you may get internal IDs rather than vanity names — evaluate which identifier your workflow needs.

How does Linkesy help once I have usernames?

After connecting an account securely via OAuth, Linkesy generates and schedules personalized posts that match your voice and style—no manual username maintenance required for connected profiles. Explore a free trial to see how it saves time: Try Linkesy free.

Conclusion — make the right choice for scale and compliance

Extracting a LinkedIn username from a URL is straightforward for individual profiles and essential for personalization and automation. For bulk or recurring tasks, choose OAuth/API-based solutions or a trusted tool that respects LinkedIn policies. If your goal is consistent personal-brand growth with minimal manual work, try Linkesy to automate content creation, image generation, and 30-day scheduling in minutes.

Next steps: If you want a safe, automated path from profile data to scheduled posts, Try Linkesy free or See our plans. For more technical reference, visit our Tools & Technology pillar.

Extract LinkedIn username example

Frequently Asked Questions

How do I find a LinkedIn username from a URL?

Open the LinkedIn profile URL and copy the text after /in/ until the next slash or question mark. Use a regex like linkedin.com\/in\/([^\/?#]+) to automate extraction.

Is the LinkedIn username the same as the internal ID?

No. The public username (vanity) appears in the URL after /in/. LinkedIn's internal IDs (urn:li:person:...) are used by APIs and are different from the public handle.

Can I use LinkedIn API to get usernames?

Yes — the LinkedIn API can return structured profile data if you have the proper permissions and OAuth consent. Follow LinkedIn's developer docs and rate limits.

Is scraping LinkedIn URLs allowed?

Scraping can violate LinkedIn's terms and may trigger bans or legal risks. Prefer OAuth/API access and always respect user privacy and data protection laws.

How can Linkesy help with LinkedIn usernames?

Linkesy uses secure OAuth connections to access profile data for authorized accounts, enabling personalized AI post generation and 30-day auto-scheduling without manual username maintenance.

What regex works for extracting usernames?

A commonly used pattern is linkedin\.com\/(?:in|pub)\/([^\/?#]+). It captures the public identifier after /in/ or /pub/ until the next slash or query string.
Our Ecosystem

More free AI tools from the same team

UPAI AI Blog Automation & SEO Tools

Create SEO-optimized blog posts in seconds with AI. Try AI blog content automation for free.

Read the UPAI blog

Ask AI about Linkesy

Click your favorite assistant to learn more about us