Skip to main content
Creating short links on shrtnr is simple and fast. This guide covers the entire link creation workflow, from basic anonymous links to fully customized short URLs with custom slugs and expiration dates. You don’t need an account to create short links. Here’s how:
1

Navigate to the home page

Visit the shrtnr home page at /. You’ll see a prominent URL input field in the hero section.
2

Paste your long URL

In the input field labeled “Paste your long URL here”, enter the full URL you want to shorten.The URL must be a valid format. Examples:
  • https://example.com/very/long/path/to/page?query=params
  • https://docs.example.com/documentation/getting-started
  • https://www.youtube.com/watch?v=dQw4w9WgXcQ
3

Click 'Shorten'

Click the Shorten button (or press Enter). The system will:
  1. Validate your URL
  2. Generate a random 8-character short code
  3. Store the URL mapping in the database
  4. Return the short URL
  5. Automatically copy it to your clipboard
4

Use your short link

A toast notification will appear with your short link (e.g., Short link copied: https://shrtnr.app/abc12345).Share this link anywhere - when someone clicks it, they’ll be redirected to your original URL.
Anonymous links (created without signing in) are stored in the database but cannot be managed or tracked in a dashboard. Sign in to access link management features.
When you’re signed in, you unlock powerful customization options:

Custom Slugs

Instead of random short codes, you can choose memorable slugs for your links.
1

Sign in to your account

Make sure you’re signed in. You’ll know you’re authenticated when you see additional fields below the main URL input.
2

Enter your destination URL

Paste the long URL you want to shorten in the main input field.
3

Specify a custom slug

In the Custom slug (optional) field, enter your desired short code.For example, entering my-link will create https://shrtnr.app/my-link.
4

Click 'Shorten'

Submit the form. If the slug is available and valid, your custom short link will be created.

Slug validation rules

Custom slugs must follow these rules:
Only letters (a-z, A-Z), numbers (0-9), hyphens (-), and underscores (_) are permitted.Examples:
  • my-link
  • promo_2024
  • Campaign123
  • my link (spaces not allowed)
  • promo@sale (special characters not allowed)
Slugs must be between 1 and 20 characters long.
  • a (minimum)
  • my-custom-short-link (18 characters)
  • ❌ “ (empty)
  • this-is-a-very-long-slug-name (29 characters, too long)
Each slug must be unique across the entire platform. If someone else has already used my-link, you’ll receive an error: Slug already in use.Try variations:
  • my-link-2024
  • my_link_v2
  • mylink-alt
If you try to use a custom slug without being signed in, you’ll receive an error: Sign in to use a custom slug. Authentication is required for this feature.

Setting Expiration Dates

Control how long your short links remain active by setting an expiration date.
1

Access the expiry control

When signed in, you’ll see an Expires in (days, 1–30) field below the custom slug input.
2

Set the number of days

Enter a number between 1 and 30 to set how many days from now the link will expire.
  • Default: 7 days
  • Minimum: 1 day
  • Maximum: 30 days
The input automatically clamps values outside this range.
3

Create the link

When you click Shorten, the system calculates the expiration date:
expiresAt = now + (expiresInDays * 24 hours)
For example, if you set 7 days, the link will expire exactly 7 days from the creation timestamp.
After a link expires, attempts to visit it will result in an error or redirect. Expired links can be viewed in your dashboard but cannot be accessed by visitors.

Combining Custom Slugs and Expiration

You can use both features together:
{
  "url": "https://example.com/sale",
  "customSlug": "holiday-sale",
  "expiresInDays": 14
}
This creates https://shrtnr.app/holiday-sale that expires in 14 days. The link creation process sends a POST request to /api/shorten with the following payload:

Request format

{
  "url": "https://example.com/path",      // required
  "customSlug": "my-link",                // optional, requires auth
  "expiresInDays": 7                      // optional, requires auth
}

Response format

On success:
{
  "shortCode": "abc12345",
  "shortUrl": "https://shrtnr.app/abc12345"
}

Error responses

StatusErrorCause
400URL is requiredMissing or empty URL
400Invalid URLURL format is invalid
400Invalid slugCustom slug violates validation rules
400Slug already in useCustom slug is taken
401Sign in to use a custom slugAttempted custom slug without auth
500Something went wrongServer or database error

UI Behavior

Button states

The Shorten button has three states:
  1. Disabled (no URL entered)
    • Appears grayed out
    • Cursor shows “not-allowed”
    • Button text: “Shorten”
  2. Processing (request in flight)
    • Button disabled
    • Reduced opacity
    • Button text: “Shortening…”
  3. Ready (URL entered, not processing)
    • Fully interactive
    • Button text: “Shorten”
    • Click to submit

Automatic clipboard copy

When a short link is successfully created:
  1. The short URL is automatically copied to your clipboard via navigator.clipboard.writeText()
  2. A toast notification appears: Short link copied: https://shrtnr.app/...
  3. You can immediately paste the link wherever you need it
If clipboard access fails (due to browser permissions), the toast will still show your short URL so you can copy it manually.

Best Practices

For links you’ll share frequently, use descriptive custom slugs:
  • blog-post-seo instead of random codes
  • webinar-2024 for event links
  • github-repo for repositories
This makes links easier to remember and more trustworthy.
Match expiration to your use case:
  • 1-3 days: Time-sensitive promotions, flash sales
  • 7 days: Weekly newsletters, temporary campaigns
  • 14-30 days: Monthly events, longer campaigns
Avoid setting very short expirations for links you plan to share widely.
Make sure your destination URL:
  • Includes the protocol (https://, not just example.com)
  • Is correctly formatted with no typos
  • Points to an active, accessible page
Invalid destinations will confuse users who click your short link.

Next Steps

After creating your short links:
  • View all links: Visit your dashboard (see Dashboard guide) to see all links you’ve created
  • Edit links: Change slugs or expiration dates in the dashboard
  • Track performance: Monitor click counts for each link
  • Manage links: Delete links you no longer need
Learn more in the Managing Links guide.

Build docs developers (and LLMs) love