Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

New free tools

Blue Mouseecd558bdd24b
diff --git a/web/app/components/ToolsNav.tsx b/web/app/components/ToolsNav.tsx
index 1266e0ad9..8c1e79d72 100644
--- a/web/app/components/ToolsNav.tsx
+++ b/web/app/components/ToolsNav.tsx
@@ -12,6 +12,9 @@ import {
QrCodeIcon,
BracketsCurlyIcon,
RobotIcon,
+ FunnelIcon,
+ ShareNetworkIcon,
+ PercentIcon,
} from '@phosphor-icons/react'
import { useState } from 'react'
import { Link, useLocation } from 'react-router'
@@ -104,6 +107,28 @@ export const TOOLS = [
href: '/tools/robots-txt-generator',
icon: RobotIcon,
},
+ {
+ id: 'conversion-rate-calculator',
+ title: 'Conversion Rate Calculator',
+ description: 'Calculate conversion rate, traffic needs, and revenue impact',
+ href: '/tools/conversion-rate-calculator',
+ icon: FunnelIcon,
+ },
+ {
+ id: 'og-preview',
+ title: 'Open Graph Preview',
+ description:
+ 'Preview social media cards for Google, Facebook, X, and LinkedIn',
+ href: '/tools/og-preview',
+ icon: ShareNetworkIcon,
+ },
+ {
+ id: 'percentage-calculator',
+ title: 'Percentage Calculator',
+ description: 'Calculate percentages, percentage of, and percentage change',
+ href: '/tools/percentage-calculator',
+ icon: PercentIcon,
+ },
] as const
interface ToolsNavProps {
diff --git a/web/app/routes/tools.conversion-rate-calculator.tsx b/web/app/routes/tools.conversion-rate-calculator.tsx
new file mode 100644
index 000000000..e09127f49
--- /dev/null
+++ b/web/app/routes/tools.conversion-rate-calculator.tsx
@@ -0,0 +1,681 @@
+import { TrendUpIcon } from '@phosphor-icons/react'
+import { useState } from 'react'
+import type { MetaFunction } from 'react-router'
+import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
+import { DitchGoogle } from '~/components/marketing/DitchGoogle'
+import { ToolsNav, ToolsNavMobile } from '~/components/ToolsNav'
+import { getOgImageUrl, isSelfhosted } from '~/lib/constants'
+import Button from '~/ui/Button'
+import Input from '~/ui/Input'
+import { FAQ } from '~/ui/FAQ'
+import { Text } from '~/ui/Text'
+import { getDescription, getPreviewImage, getTitle } from '~/utils/seo'
+
+export const meta: MetaFunction = () => {
+ const title =
+ 'Free Conversion Rate Calculator - Calculate Your Website Conversion Rate'
+ const description =
+ "Calculate your website's conversion rate instantly. Enter visitors and conversions to get your rate, performance rating, and actionable insights. Free conversion rate calculator for ecommerce, SaaS, and landing pages."
+ return [
+ ...getTitle(title),
+ ...getDescription(description),
+ ...getPreviewImage(getOgImageUrl(title, description)),
+ ]
+}
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 0.8,
+ exclude: isSelfhosted,
+})
+
+export async function loader() {
+ if (isSelfhosted) {
+ return redirect('/login', 302)
+ }
+
+ return null
+}
+
+const FAQ_ITEMS = [
+ {
+ question: 'What is a conversion rate?',
+ answer:
+ 'A conversion rate is the percentage of visitors who complete a desired action on your website, such as making a purchase, signing up for a newsletter, filling out a form, or downloading a resource. It is calculated by dividing the number of conversions by the total number of visitors, then multiplying by 100.',
+ },
+ {
+ question: 'What is a good conversion rate?',
+ answer:
+ 'A good conversion rate varies by industry, but the average website conversion rate is around 2-5%. Ecommerce sites typically see 1-4%, SaaS landing pages average 3-7%, and highly optimized pages can reach 10%+. The best benchmark is your own historical performance.',
+ },
+ {
+ question: 'How do I calculate conversion rate?',
+ answer:
+ 'Conversion rate is calculated using the formula: Conversion Rate = (Number of Conversions ÷ Total Visitors) × 100. For example, if you had 50 sales from 2,000 visitors, your conversion rate would be (50 ÷ 2000) × 100 = 2.5%.',
+ },
+ {
+ question: 'What is the difference between conversion rate and CTR?',
+ answer:
+ 'CTR (Click-Through Rate) measures the percentage of people who click on an ad or link after seeing it, while conversion rate measures the percentage of visitors who complete a desired action after landing on your page. CTR measures ad engagement; conversion rate measures page effectiveness.',
+ },
+ {
+ question: 'How can I improve my conversion rate?',
+ answer:
+ 'Improve conversion rates by optimizing your landing page copy and design, adding clear calls-to-action (CTAs), reducing page load time, using social proof and testimonials, simplifying forms, running A/B tests, improving mobile experience, and ensuring your value proposition is clear.',
+ },
+ {
+ question: 'What is Conversion Rate Optimization (CRO)?',
+ answer:
+ 'Conversion Rate Optimization (CRO) is the systematic process of increasing the percentage of website visitors who take a desired action. It involves analyzing user behavior, identifying friction points, forming hypotheses, and running experiments like A/B tests to improve performance.',
+ },
+ {
+ question: 'What factors affect conversion rate?',
+ answer:
+ 'Key factors include page load speed, mobile responsiveness, trust signals (SSL, reviews), clear value proposition, CTA placement and copy, form length, visual design, traffic quality, pricing transparency, and user experience. Seasonal trends and competition also play a role.',
+ },
+ {
+ question: 'Can Swetrix help track my conversion rates?',
+ answer:
+ 'Yes! Swetrix provides privacy-first analytics that lets you track custom events and goals to measure conversion rates across your website. You can monitor funnels, compare conversion rates by traffic source, and get actionable insights without compromising user privacy.',
+ },
+]
+
+type Mode = 'rate' | 'traffic' | 'revenue'
+
+interface RateInputs {
+ visitors: string
+ conversions: string
+}
+
+interface TrafficInputs {
+ targetConversions: string
+ expectedRate: string
+}
+
+interface RevenueInputs {
+ visitors: string
+ conversionRate: string
+ averageOrderValue: string
+}
+
+interface RateResult {
+ rate: number
+ performance: 'Excellent' | 'Good' | 'Average' | 'Below Average' | 'Poor'
+ color: string
+}
+
+function getPerformance(
+ rate: number,
+): Pick<RateResult, 'performance' | 'color'> {
+ if (rate >= 8)
+ return {
+ performance: 'Excellent',
+ color: 'text-green-600 dark:text-green-400',
+ }
+ if (rate >= 5)
+ return { performance: 'Good', color: 'text-blue-600 dark:text-blue-400' }
+ if (rate >= 2.5)
+ return {
+ performance: 'Average',
+ color: 'text-yellow-600 dark:text-yellow-400',
+ }
+ if (rate >= 1)
+ return {
+ performance: 'Below Average',
+ color: 'text-orange-600 dark:text-orange-400',
+ }
+ return { performance: 'Poor', color: 'text-red-600 dark:text-red-400' }
+}
+
+const MODES: { id: Mode; label: string }[] = [
+ { id: 'rate', label: 'Calculate Rate' },
+ { id: 'traffic', label: 'Estimate Traffic' },
+ { id: 'revenue', label: 'Revenue Impact' },
+]
+
+export default function ConversionRateCalculator() {
+ const [mode, setMode] = useState<Mode>('rate')
+
+ const [rateInputs, setRateInputs] = useState<RateInputs>({
+ visitors: '',
+ conversions: '',
+ })
+ const [rateResult, setRateResult] = useState<RateResult | null>(null)
+
+ const [trafficInputs, setTrafficInputs] = useState<TrafficInputs>({
+ targetConversions: '',
+ expectedRate: '',
+ })
+ const [trafficResult, setTrafficResult] = useState<number | null>(null)
+
+ const [revenueInputs, setRevenueInputs] = useState<RevenueInputs>({
+ visitors: '',
+ conversionRate: '',
+ averageOrderValue: '',
+ })
+ const [revenueResult, setRevenueResult] = useState<{
+ conversions: number
+ revenue: number
+ improvedRevenue: number
+ } | null>(null)
+
+ const handleRateChange = (key: keyof RateInputs, value: string) => {
+ const newInputs = { ...rateInputs, [key]: value }
+ setRateInputs(newInputs)
+
+ const visitors = parseFloat(newInputs.visitors)
+ const conversions = parseFloat(newInputs.conversions)
+
+ if (visitors > 0 && conversions >= 0) {
+ const rate = (conversions / visitors) * 100
+ setRateResult({ rate, ...getPerformance(rate) })
+ } else {
+ setRateResult(null)
+ }
+ }
+
+ const handleTrafficChange = (key: keyof TrafficInputs, value: string) => {
+ const newInputs = { ...trafficInputs, [key]: value }
+ setTrafficInputs(newInputs)
+
+ const target = parseFloat(newInputs.targetConversions)
+ const rate = parseFloat(newInputs.expectedRate)
+
+ if (target > 0 && rate > 0) {
+ setTrafficResult(Math.ceil(target / (rate / 100)))
+ } else {
+ setTrafficResult(null)
+ }
+ }
+
+ const handleRevenueChange = (key: keyof RevenueInputs, value: string) => {
+ const newInputs = { ...revenueInputs, [key]: value }
+ setRevenueInputs(newInputs)
+
+ const visitors = parseFloat(newInputs.visitors)
+ const rate = parseFloat(newInputs.conversionRate)
+ const aov = parseFloat(newInputs.averageOrderValue)
+
+ if (visitors > 0 && rate > 0 && aov > 0) {
+ const conversions = Math.round(visitors * (rate / 100))
+ const revenue = conversions * aov
+ const improvedRate = rate * 1.25
+ const improvedConversions = Math.round(visitors * (improvedRate / 100))
+ const improvedRevenue = improvedConversions * aov
+ setRevenueResult({ conversions, revenue, improvedRevenue })
+ } else {
+ setRevenueResult(null)
+ }
+ }
+
+ const reset = () => {
+ setRateInputs({ visitors: '', conversions: '' })
+ setRateResult(null)
+ setTrafficInputs({ targetConversions: '', expectedRate: '' })
+ setTrafficResult(null)
+ setRevenueInputs({
+ visitors: '',
+ conversionRate: '',
+ averageOrderValue: '',
+ })
+ setRevenueResult(null)
+ }
+
+ return (
+ <div className='min-h-screen bg-gray-50 dark:bg-slate-950'>
+ <main className='mx-auto max-w-7xl px-4 py-12 sm:px-6 lg:px-8'>
+ <ToolsNavMobile className='mb-6 lg:hidden' />
+
+ <div className='lg:flex lg:items-start lg:gap-8'>
+ <div className='min-w-0 lg:flex-1'>
+ <Text as='h1' size='4xl' weight='bold' tracking='tight'>
+ Conversion Rate Calculator
+ </Text>
+ <Text as='p' size='lg' colour='muted' className='mt-4'>
+ Calculate your website conversion rate, estimate required traffic,
+ and project revenue impact
+ </Text>
+
+ <div className='mt-12 rounded-lg bg-white p-8 ring-1 ring-gray-200 dark:bg-slate-950 dark:ring-slate-800'>
+ <div className='space-y-6'>
+ <div className='flex gap-1 rounded-lg bg-gray-100 p-1 dark:bg-slate-900'>
+ {MODES.map((m) => (
+ <button
+ key={m.id}
+ type='button'
+ onClick={() => setMode(m.id)}
+ className={`flex-1 rounded-md px-3 py-2 text-sm font-medium transition-colors ${
+ mode === m.id
+ ? 'bg-white text-gray-900 shadow-sm dark:bg-slate-950 dark:text-white'
+ : 'text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white'
+ }`}
+ >
+ {m.label}
+ </button>
+ ))}
+ </div>
+
+ {mode === 'rate' && (
+ <div>
+ <h2 className='mb-6 text-2xl font-semibold text-gray-900 dark:text-white'>
+ Calculate Your Conversion Rate
+ </h2>
+
+ <div className='grid gap-6 md:grid-cols-2'>
+ <div>
+ <Input
+ type='number'
+ placeholder='e.g. 10000'
+ label='Total Visitors'
+ value={rateInputs.visitors}
+ onChange={(e) =>
+ handleRateChange('visitors', e.target.value)
+ }
+ className='w-full'
+ min='1'
+ />
+ <p className='mt-1 text-sm text-gray-500 dark:text-gray-400'>
+ Total number of visitors or sessions
+ </p>
+ </div>
+
+ <div>
+ <Input
+ type='number'
+ placeholder='e.g. 250'
+ label='Total Conversions'
+ value={rateInputs.conversions}
+ onChange={(e) =>
+ handleRateChange('conversions', e.target.value)
+ }
+ className='w-full'
+ min='0'
+ />
+ <p className='mt-1 text-sm text-gray-500 dark:text-gray-400'>
+ Purchases, signups, or other goals completed
+ </p>
+ </div>
+ </div>
+
+ <div className='mt-6'>
+ <Button onClick={reset} secondary regular>
+ Reset
+ </Button>
+ </div>
+
+ {rateResult ? (
+ <div className='mt-6 border-t border-gray-200 pt-6 dark:border-gray-700'>
+ <h3 className='mb-4 text-lg font-medium text-gray-900 dark:text-white'>
+ Results
+ </h3>
+
+ <div className='rounded-lg bg-gray-50 p-6 dark:bg-slate-900'>
+ <div className='text-center'>
+ <div className='text-5xl font-bold text-gray-900 dark:text-white'>
+ {rateResult.rate.toFixed(2)}%
+ </div>
+ <div className='mt-2 text-lg text-gray-600 dark:text-gray-400'>
+ Conversion Rate
+ </div>
+ <div
+ className={`mt-4 text-lg font-semibold ${rateResult.color}`}
+ >
+ {rateResult.performance} Performance
+ </div>
+ </div>
+
+ <div className='mt-6 grid gap-4 text-sm md:grid-cols-2'>
+ <div className='rounded-lg bg-white p-4 dark:bg-slate-950'>
+ <div className='text-gray-500 dark:text-gray-400'>
+ Formula Used
+ </div>
+ <div className='mt-1 font-mono text-gray-900 dark:text-white'>
+ CR = (Conversions ÷ Visitors) × 100
+ </div>
+ </div>
+ <div className='rounded-lg bg-white p-4 dark:bg-slate-950'>
+ <div className='text-gray-500 dark:text-gray-400'>
+ Your Calculation
+ </div>
+ <div className='mt-1 font-mono text-gray-900 dark:text-white'>
+ ({rateInputs.conversions} ÷{' '}
+ {rateInputs.visitors}) × 100
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div className='mt-6 rounded-lg bg-indigo-50 p-4 dark:bg-indigo-900/20'>
+ <h4 className='flex items-center text-lg font-medium text-indigo-900 dark:text-indigo-300'>
+ <TrendUpIcon className='mr-2 h-5 w-5' />
+ Performance Insights
+ </h4>
+ <p className='mt-2 text-sm text-indigo-800 dark:text-indigo-200'>
+ {rateResult.performance === 'Excellent' &&
+ 'Outstanding conversion rate! Your page is performing exceptionally well. Focus on scaling traffic while maintaining quality.'}
+ {rateResult.performance === 'Good' &&
+ 'Solid conversion rate. You are above industry average. Consider A/B testing to push performance even higher.'}
+ {rateResult.performance === 'Average' &&
+ 'Decent conversion rate, but there is room to grow. Focus on optimizing your CTA, page speed, and value proposition.'}
+ {rateResult.performance === 'Below Average' &&
+ 'Below average. Review your landing page copy, user experience, and traffic quality for quick wins.'}
+ {rateResult.performance === 'Poor' &&
+ 'Low conversion rate suggests significant friction. Audit your funnel for issues like slow load times, unclear messaging, or poor mobile experience.'}
+ </p>
+ </div>
+ </div>
+ ) : null}
+ </div>
+ )}
+
+ {mode === 'traffic' && (
+ <div>
+ <h2 className='mb-6 text-2xl font-semibold text-gray-900 dark:text-white'>
+ How Much Traffic Do You Need?
+ </h2>
+
+ <div className='grid gap-6 md:grid-cols-2'>
+ <div>
+ <Input
+ type='number'
+ placeholder='e.g. 500'
+ label='Target Conversions'
+ value={trafficInputs.targetConversions}
+ onChange={(e) =>
+ handleTrafficChange(
+ 'targetConversions',
+ e.target.value,
+ )
+ }
+ className='w-full'
+ min='1'
+ />
+ <p className='mt-1 text-sm text-gray-500 dark:text-gray-400'>
+ How many conversions you want to achieve
+ </p>
+ </div>
+
+ <div>
+ <Input
+ type='number'
+ placeholder='e.g. 3.5'
+ label='Expected Conversion Rate (%)'
+ value={trafficInputs.expectedRate}
+ onChange={(e) =>
+ handleTrafficChange('expectedRate', e.target.value)
+ }
+ className='w-full'
+ min='0.01'
+ step='0.1'
+ />
+ <p className='mt-1 text-sm text-gray-500 dark:text-gray-400'>
+ Your current or expected conversion rate
+ </p>
+ </div>
+ </div>
+
+ <div className='mt-6'>
+ <Button onClick={reset} secondary regular>
+ Reset
+ </Button>
+ </div>
+
+ {trafficResult !== null ? (
+ <div className='mt-6 border-t border-gray-200 pt-6 dark:border-gray-700'>
+ <div className='rounded-lg bg-gray-50 p-6 dark:bg-slate-900'>
+ <div className='text-center'>
+ <div className='text-5xl font-bold text-gray-900 dark:text-white'>
+ {trafficResult.toLocaleString()}
+ </div>
+ <div className='mt-2 text-lg text-gray-600 dark:text-gray-400'>
+ Visitors needed
+ </div>
+ </div>
+
+ <div className='mt-6 rounded-lg bg-white p-4 text-sm dark:bg-slate-950'>
+ <div className='text-gray-500 dark:text-gray-400'>
+ Your Calculation
+ </div>
+ <div className='mt-1 font-mono text-gray-900 dark:text-white'>
+ {trafficInputs.targetConversions} ÷ (
+ {trafficInputs.expectedRate}% ÷ 100) ={' '}
+ {trafficResult.toLocaleString()} visitors
+ </div>
+ </div>
+ </div>
+ </div>
+ ) : null}
+ </div>
+ )}
+
+ {mode === 'revenue' && (
+ <div>
+ <h2 className='mb-6 text-2xl font-semibold text-gray-900 dark:text-white'>
+ Revenue Impact Calculator
+ </h2>
+
+ <div className='grid gap-6 md:grid-cols-3'>
+ <div>
+ <Input
+ type='number'
+ placeholder='e.g. 50000'
+ label='Monthly Visitors'
+ value={revenueInputs.visitors}
+ onChange={(e) =>
+ handleRevenueChange('visitors', e.target.value)
+ }
+ className='w-full'
+ min='1'
+ />
+ </div>
+ <div>
+ <Input
+ type='number'
+ placeholder='e.g. 2.5'
+ label='Conversion Rate (%)'
+ value={revenueInputs.conversionRate}
+ onChange={(e) =>
+ handleRevenueChange(
+ 'conversionRate',
+ e.target.value,
+ )
+ }
+ className='w-full'
+ min='0.01'
+ step='0.1'
+ />
+ </div>
+ <div>
+ <Input
+ type='number'
+ placeholder='e.g. 65'
+ label='Avg. Order Value ($)'
+ value={revenueInputs.averageOrderValue}
+ onChange={(e) =>
+ handleRevenueChange(
+ 'averageOrderValue',
+ e.target.value,
+ )
+ }
+ className='w-full'
+ min='0.01'
+ step='0.01'
+ />
+ </div>
+ </div>
+
+ <div className='mt-6'>
+ <Button onClick={reset} secondary regular>
+ Reset
+ </Button>
+ </div>
+
+ {revenueResult ? (
+ <div className='mt-6 border-t border-gray-200 pt-6 dark:border-gray-700'>
+ <div className='rounded-lg bg-gray-50 p-6 dark:bg-slate-900'>
+ <div className='grid gap-6 md:grid-cols-3'>
+ <div className='text-center'>
+ <div className='text-3xl font-bold text-gray-900 dark:text-white'>
+ {revenueResult.conversions.toLocaleString()}
+ </div>
+ <div className='mt-1 text-sm text-gray-600 dark:text-gray-400'>
+ Monthly Conversions
+ </div>
+ </div>
+ <div className='text-center'>
+ <div className='text-3xl font-bold text-gray-900 dark:text-white'>
+ ${revenueResult.revenue.toLocaleString()}
+ </div>
+ <div className='mt-1 text-sm text-gray-600 dark:text-gray-400'>
+ Current Monthly Revenue
+ </div>
+ </div>
+ <div className='text-center'>
+ <div className='text-3xl font-bold text-green-600 dark:text-green-400'>
+ $
+ {revenueResult.improvedRevenue.toLocaleString()}
+ </div>
+ <div className='mt-1 text-sm text-gray-600 dark:text-gray-400'>
+ Revenue with 25% CR lift
+ </div>
+ </div>
+ </div>
+
+ <div className='mt-6 rounded-lg bg-green-50 p-4 text-center dark:bg-green-900/20'>
+ <Text
+ size='sm'
+ className='text-green-800 dark:text-green-200'
+ >
+ A 25% improvement in conversion rate would
+ generate an additional{' '}
+ <span className='font-bold'>
+ $
+ {(
+ revenueResult.improvedRevenue -
+ revenueResult.revenue
+ ).toLocaleString()}
+ </span>{' '}
+ per month
+ </Text>
+ </div>
+ </div>
+ </div>
+ ) : null}
+ </div>
+ )}
+ </div>
+ </div>
+
+ <section className='mt-20 border-t border-gray-200 pt-16 dark:border-slate-700'>
+ <Text as='h2' size='3xl' weight='bold' tracking='tight'>
+ Free Conversion Rate Calculator for Websites
+ </Text>
+ <Text
+ as='p'
+ size='lg'
+ colour='muted'
+ className='mt-4 leading-relaxed'
+ >
+ Use our free conversion rate calculator to measure and optimize
+ your website performance. Whether you run an ecommerce store,
+ SaaS product, or lead generation site, understanding your
+ conversion rate is essential to growing revenue and improving
+ your marketing ROI. This tool helps you calculate conversion
+ rates, estimate traffic requirements, and project the revenue
+ impact of conversion rate optimization (CRO).
+ </Text>
+
+ <div className='mt-12 grid gap-x-12 gap-y-10 md:grid-cols-2'>
+ <div>
+ <Text as='h3' size='xl' weight='semibold'>
+ Why Conversion Rate Matters
+ </Text>
+ <ul className='mt-3 space-y-2'>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Revenue Growth
+ </Text>{' '}
+ - Even small conversion rate improvements can
+ dramatically increase revenue without spending more on
+ traffic acquisition.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Marketing Efficiency
+ </Text>{' '}
+ - A higher conversion rate means you get more value from
+ every visitor, lowering your effective cost per
+ acquisition (CPA).
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Competitive Advantage
+ </Text>{' '}
+ - Optimized conversion rates let you outbid competitors
+ on paid channels while maintaining profitability.
+ </Text>
+ </li>
+ </ul>
+ </div>
+ <div>
+ <Text as='h3' size='xl' weight='semibold'>
+ Conversion Rate Optimization Tips
+ </Text>
+ <ul className='mt-3 space-y-2'>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Optimize page speed
+ </Text>{' '}
+ - Every second of delay reduces conversions by up to 7%.
+ Compress images, minimize scripts, and use a CDN.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Simplify your forms
+ </Text>{' '}
+ - Reduce form fields to only what is essential. Each
+ extra field can decrease conversion rates by 4-11%.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Add social proof
+ </Text>{' '}
+ - Testimonials, reviews, and trust badges increase
+ visitor confidence and drive higher conversion rates.
+ </Text>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </section>
+
+ <div className='mt-16'>
+ <h2 className='mb-8 text-center text-3xl font-bold text-gray-900 dark:text-white'>
+ Frequently Asked Questions
+ </h2>
+
+ <FAQ items={FAQ_ITEMS} withStructuredData />
+ </div>
+
+ <DitchGoogle />
+ </div>
+
+ <aside className='hidden lg:sticky lg:top-12 lg:block lg:w-64 lg:shrink-0 lg:self-start'>
+ <ToolsNav />
+ </aside>
+ </div>
+ </main>
+ </div>
+ )
+}
diff --git a/web/app/routes/tools.og-preview.tsx b/web/app/routes/tools.og-preview.tsx
new file mode 100644
index 000000000..11560c111
--- /dev/null
+++ b/web/app/routes/tools.og-preview.tsx
@@ -0,0 +1,485 @@
+import { useState } from 'react'
+import type { MetaFunction } from 'react-router'
+import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
+import { DitchGoogle } from '~/components/marketing/DitchGoogle'
+import { ToolsNav, ToolsNavMobile } from '~/components/ToolsNav'
+import { getOgImageUrl, isSelfhosted } from '~/lib/constants'
+import Input from '~/ui/Input'
+import Textarea from '~/ui/Textarea'
+import { FAQ } from '~/ui/FAQ'
+import { Text } from '~/ui/Text'
+import { getDescription, getPreviewImage, getTitle } from '~/utils/seo'
+
+export const meta: MetaFunction = () => {
+ const title = 'Free Open Graph Preview Tool - Preview Social Media Cards'
+ const description =
+ 'Preview how your website looks when shared on Twitter/X, Facebook, and LinkedIn. Test your Open Graph meta tags and Twitter Cards instantly. Free OG preview tool with live rendering.'
+ return [
+ ...getTitle(title),
+ ...getDescription(description),
+ ...getPreviewImage(getOgImageUrl(title, description)),
+ ]
+}
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 0.8,
+ exclude: isSelfhosted,
+})
+
+export async function loader() {
+ if (isSelfhosted) {
+ return redirect('/login', 302)
+ }
+
+ return null
+}
+
+const FAQ_ITEMS = [
+ {
+ question: 'What are Open Graph tags?',
+ answer:
+ 'Open Graph (OG) tags are HTML meta tags that control how your website content appears when shared on social media platforms like Facebook, Twitter/X, LinkedIn, and messaging apps. They define the title, description, image, and URL shown in the social media card preview.',
+ },
+ {
+ question: 'Why are Open Graph tags important for SEO?',
+ answer:
+ 'While Open Graph tags do not directly affect search engine rankings, they significantly impact click-through rates from social media. Well-optimized OG tags with compelling titles, descriptions, and images lead to more clicks, shares, and engagement, which can indirectly boost SEO through increased traffic and brand visibility.',
+ },
+ {
+ question: 'What is the ideal Open Graph image size?',
+ answer:
+ 'The recommended Open Graph image size is 1200×630 pixels (1.91:1 ratio) for optimal display across all platforms. Facebook recommends at least 600×315 pixels, while Twitter/X Cards work best with 1200×628 pixels. Always use high-quality images under 5MB in PNG or JPG format.',
+ },
+ {
+ question:
+ 'What is the difference between Open Graph tags and Twitter Cards?',
+ answer:
+ 'Open Graph tags (og:title, og:description, og:image) are used by Facebook, LinkedIn, and most platforms. Twitter Cards (twitter:card, twitter:title, twitter:description, twitter:image) are Twitter/X specific. Twitter/X will fall back to OG tags if Twitter Card tags are not present, so most sites use both for maximum compatibility.',
+ },
+ {
+ question: 'What Open Graph tags should every page have?',
+ answer:
+ 'Every page should include at minimum: og:title (page title), og:description (brief summary), og:image (preview image URL), og:url (canonical URL), and og:type (usually "website" or "article"). For Twitter/X, also add twitter:card (usually "summary_large_image").',
+ },
+ {
+ question: 'How do I debug Open Graph tags on my site?',
+ answer:
+ "Use this preview tool to see how your OG tags will render. For live debugging, use Facebook's Sharing Debugger (developers.facebook.com/tools/debug), Twitter/X Card Validator, and LinkedIn Post Inspector. These tools also let you clear cached previews after updating your tags.",
+ },
+ {
+ question: 'Why is my Open Graph image not showing?',
+ answer:
+ 'Common reasons include: the image URL is not absolute (must start with https://), the image is too small (minimum 200×200 pixels), the server blocks crawlers, the image format is unsupported, or the platform has cached an old version. Use platform-specific debuggers to clear the cache.',
+ },
+ {
+ question: 'Can Swetrix help track social media traffic?',
+ answer:
+ 'Yes! Swetrix tracks referral sources including social media platforms, so you can see how much traffic comes from Facebook, Twitter/X, LinkedIn, and other platforms. Combined with UTM parameters, you can measure the exact impact of your social sharing strategy.',
+ },
+]
+
+type Platform = 'google' | 'facebook' | 'twitter' | 'linkedin'
+
+interface OGInputs {
+ title: string
+ description: string
+ url: string
+ imageUrl: string
+ siteName: string
+}
+
+const PLATFORMS: { id: Platform; label: string }[] = [
+ { id: 'google', label: 'Google' },
+ { id: 'facebook', label: 'Facebook' },
+ { id: 'twitter', label: 'Twitter / X' },
+ { id: 'linkedin', label: 'LinkedIn' },
+]
+
+function GooglePreview({ inputs }: { inputs: OGInputs }) {
+ const displayUrl = inputs.url || 'example.com'
+ const breadcrumb = (() => {
+ try {
+ const url = new URL(
+ displayUrl.startsWith('http') ? displayUrl : `https://${displayUrl}`,
+ )
+ return (
+ url.hostname +
+ (url.pathname !== '/'
+ ? ` › ${url.pathname.slice(1).replace(/\//g, ' › ')}`
+ : '')
+ )
+ } catch {
+ return displayUrl
+ }
+ })()
+
+ return (
+ <div className='max-w-[600px] font-sans'>
+ <div className='text-sm text-gray-600 dark:text-gray-400'>
+ {breadcrumb}
+ </div>
+ <div className='mt-0.5 text-xl leading-snug text-blue-700 hover:underline dark:text-blue-400'>
+ {inputs.title || 'Page Title'}
+ </div>
+ <div className='mt-1 text-sm leading-relaxed text-gray-600 dark:text-gray-400'>
+ {inputs.description ||
+ 'Page description will appear here. Add a compelling description to improve click-through rates from search results.'}
+ </div>
+ </div>
+ )
+}
+
+function FacebookPreview({ inputs }: { inputs: OGInputs }) {
+ const domain = (() => {
+ try {
+ const url = new URL(
+ (inputs.url || 'https://example.com').startsWith('http')
+ ? inputs.url
+ : `https://${inputs.url}`,
+ )
+ return url.hostname
+ } catch {
+ return 'example.com'
+ }
+ })()
+
+ return (
+ <div className='max-w-[500px] overflow-hidden rounded-lg border border-gray-300 bg-white dark:border-slate-700 dark:bg-slate-950'>
+ <div className='aspect-[1.91/1] w-full bg-gray-200 dark:bg-slate-900'>
+ {inputs.imageUrl ? (
+ <img
+ src={inputs.imageUrl}
+ alt='OG Preview'
+ className='h-full w-full object-cover'
+ onError={(e) => {
+ ;(e.target as HTMLImageElement).style.display = 'none'
+ }}
+ />
+ ) : (
+ <div className='flex h-full items-center justify-center text-sm text-gray-400 dark:text-gray-500'>
+ 1200 × 630 image preview
+ </div>
+ )}
+ </div>
+ <div className='p-3'>
+ <div className='text-xs tracking-wide text-gray-500 uppercase dark:text-gray-400'>
+ {domain}
+ </div>
+ <div className='mt-1 leading-snug font-semibold text-gray-900 dark:text-white'>
+ {inputs.title || 'Page Title'}
+ </div>
+ <div className='mt-0.5 line-clamp-2 text-sm text-gray-500 dark:text-gray-400'>
+ {inputs.description || 'Page description will appear here...'}
+ </div>
+ </div>
+ </div>
+ )
+}
+
+function TwitterPreview({ inputs }: { inputs: OGInputs }) {
+ const domain = (() => {
+ try {
+ const url = new URL(
+ (inputs.url || 'https://example.com').startsWith('http')
+ ? inputs.url
+ : `https://${inputs.url}`,
+ )
+ return url.hostname
+ } catch {
+ return 'example.com'
+ }
+ })()
+
+ return (
+ <div className='max-w-[500px] overflow-hidden rounded-2xl border border-gray-300 dark:border-slate-700'>
+ <div className='aspect-2/1 w-full bg-gray-200 dark:bg-slate-900'>
+ {inputs.imageUrl ? (
+ <img
+ src={inputs.imageUrl}
+ alt='Twitter Card Preview'
+ className='h-full w-full object-cover'
+ onError={(e) => {
+ ;(e.target as HTMLImageElement).style.display = 'none'
+ }}
+ />
+ ) : (
+ <div className='flex h-full items-center justify-center text-sm text-gray-400 dark:text-gray-500'>
+ 1200 × 600 image preview
+ </div>
+ )}
+ </div>
+ <div className='bg-white p-3 dark:bg-slate-950'>
+ <div className='text-sm text-gray-500 dark:text-gray-400'>{domain}</div>
+ <div className='mt-0.5 leading-snug font-medium text-gray-900 dark:text-white'>
+ {inputs.title || 'Page Title'}
+ </div>
+ <div className='mt-0.5 line-clamp-2 text-sm text-gray-500 dark:text-gray-400'>
+ {inputs.description || 'Page description will appear here...'}
+ </div>
+ </div>
+ </div>
+ )
+}
+
+function LinkedInPreview({ inputs }: { inputs: OGInputs }) {
+ return (
+ <div className='max-w-[500px] overflow-hidden rounded-lg border border-gray-300 bg-white dark:border-slate-700 dark:bg-slate-950'>
+ <div className='aspect-[1.91/1] w-full bg-gray-200 dark:bg-slate-900'>
+ {inputs.imageUrl ? (
+ <img
+ src={inputs.imageUrl}
+ alt='LinkedIn Preview'
+ className='h-full w-full object-cover'
+ onError={(e) => {
+ ;(e.target as HTMLImageElement).style.display = 'none'
+ }}
+ />
+ ) : (
+ <div className='flex h-full items-center justify-center text-sm text-gray-400 dark:text-gray-500'>
+ 1200 × 627 image preview
+ </div>
+ )}
+ </div>
+ <div className='p-3'>
+ <div className='leading-snug font-semibold text-gray-900 dark:text-white'>
+ {inputs.title || 'Page Title'}
+ </div>
+ <div className='mt-1 line-clamp-2 text-sm text-gray-500 dark:text-gray-400'>
+ {inputs.description || 'Page description will appear here...'}
+ </div>
+ </div>
+ </div>
+ )
+}
+
+export default function OGPreview() {
+ const [inputs, setInputs] = useState<OGInputs>({
+ title: '',
+ description: '',
+ url: '',
+ imageUrl: '',
+ siteName: '',
+ })
+ const [platform, setPlatform] = useState<Platform>('google')
+
+ const handleChange = (key: keyof OGInputs, value: string) => {
+ setInputs((prev) => ({ ...prev, [key]: value }))
+ }
+
+ return (
+ <div className='min-h-screen bg-gray-50 dark:bg-slate-950'>
+ <main className='mx-auto max-w-7xl px-4 py-12 sm:px-6 lg:px-8'>
+ <ToolsNavMobile className='mb-6 lg:hidden' />
+
+ <div className='lg:flex lg:items-start lg:gap-8'>
+ <div className='min-w-0 lg:flex-1'>
+ <Text as='h1' size='4xl' weight='bold' tracking='tight'>
+ Open Graph Preview
+ </Text>
+ <Text as='p' size='lg' colour='muted' className='mt-4'>
+ Preview how your website looks when shared on Google, Facebook,
+ Twitter/X, and LinkedIn
+ </Text>
+
+ <div className='mt-12 rounded-lg bg-white p-8 ring-1 ring-gray-200 dark:bg-slate-950 dark:ring-slate-800'>
+ <div className='space-y-6'>
+ <h2 className='text-2xl font-semibold text-gray-900 dark:text-white'>
+ Enter your Open Graph data
+ </h2>
+
+ <div className='space-y-4'>
+ <Input
+ type='text'
+ placeholder='My Awesome Page - Brand Name'
+ label='og:title'
+ value={inputs.title}
+ onChange={(e) => handleChange('title', e.target.value)}
+ className='w-full'
+ />
+ <Textarea
+ placeholder='A compelling description of your page content that makes people want to click...'
+ label='og:description'
+ value={inputs.description}
+ onChange={(e) =>
+ handleChange('description', e.target.value)
+ }
+ />
+ <div className='grid gap-4 md:grid-cols-2'>
+ <Input
+ type='text'
+ placeholder='https://example.com/page'
+ label='og:url'
+ value={inputs.url}
+ onChange={(e) => handleChange('url', e.target.value)}
+ className='w-full'
+ />
+ <Input
+ type='text'
+ placeholder='My Brand'
+ label='og:site_name'
+ value={inputs.siteName}
+ onChange={(e) => handleChange('siteName', e.target.value)}
+ className='w-full'
+ />
+ </div>
+ <Input
+ type='text'
+ placeholder='https://example.com/images/og-image.jpg'
+ label='og:image'
+ value={inputs.imageUrl}
+ onChange={(e) => handleChange('imageUrl', e.target.value)}
+ className='w-full'
+ />
+ </div>
+
+ <div className='border-t border-gray-200 pt-6 dark:border-gray-700'>
+ <h3 className='mb-4 text-lg font-medium text-gray-900 dark:text-white'>
+ Preview
+ </h3>
+
+ <div className='mb-4 flex gap-1 rounded-lg bg-gray-100 p-1 dark:bg-slate-900'>
+ {PLATFORMS.map((p) => (
+ <button
+ key={p.id}
+ type='button'
+ onClick={() => setPlatform(p.id)}
+ className={`flex-1 rounded-md px-3 py-2 text-sm font-medium transition-colors ${
+ platform === p.id
+ ? 'bg-white text-gray-900 shadow-sm dark:bg-slate-950 dark:text-white'
+ : 'text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white'
+ }`}
+ >
+ {p.label}
+ </button>
+ ))}
+ </div>
+
+ <div className='rounded-lg bg-gray-50 p-6 dark:bg-slate-900'>
+ {platform === 'google' && <GooglePreview inputs={inputs} />}
+ {platform === 'facebook' && (
+ <FacebookPreview inputs={inputs} />
+ )}
+ {platform === 'twitter' && (
+ <TwitterPreview inputs={inputs} />
+ )}
+ {platform === 'linkedin' && (
+ <LinkedInPreview inputs={inputs} />
+ )}
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <section className='mt-20 border-t border-gray-200 pt-16 dark:border-slate-700'>
+ <Text as='h2' size='3xl' weight='bold' tracking='tight'>
+ Free Open Graph Preview & Social Card Tester
+ </Text>
+ <Text
+ as='p'
+ size='lg'
+ colour='muted'
+ className='mt-4 leading-relaxed'
+ >
+ Test and preview your Open Graph meta tags before publishing.
+ See exactly how your pages will look when shared on Facebook,
+ Twitter/X, LinkedIn, and in Google search results. Our free OG
+ preview tool helps you optimize social media cards, improve
+ click-through rates, and ensure your content looks professional
+ across every platform.
+ </Text>
+
+ <div className='mt-12 grid gap-x-12 gap-y-10 md:grid-cols-2'>
+ <div>
+ <Text as='h3' size='xl' weight='semibold'>
+ Why Preview OG Tags?
+ </Text>
+ <ul className='mt-3 space-y-2'>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ First impressions matter
+ </Text>{' '}
+ - Your social card is the first thing people see when
+ your link is shared. A well-crafted preview dramatically
+ increases clicks.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Platform differences
+ </Text>{' '}
+ - Each platform renders social cards differently.
+ Preview across Google, Facebook, Twitter/X, and LinkedIn
+ to ensure consistency.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Catch issues early
+ </Text>{' '}
+ - Spot truncated titles, missing images, or broken
+ descriptions before your content goes live.
+ </Text>
+ </li>
+ </ul>
+ </div>
+ <div>
+ <Text as='h3' size='xl' weight='semibold'>
+ OG Tag Best Practices
+ </Text>
+ <ul className='mt-3 space-y-2'>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Title length
+ </Text>{' '}
+ - Keep og:title under 60 characters to avoid truncation
+ on most platforms.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Description length
+ </Text>{' '}
+ - og:description should be 120-160 characters for
+ optimal display across platforms.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Image dimensions
+ </Text>{' '}
+ - Use 1200×630 pixels at a 1.91:1 aspect ratio. Always
+ use absolute URLs starting with https://.
+ </Text>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </section>
+
+ <div className='mt-16'>
+ <h2 className='mb-8 text-center text-3xl font-bold text-gray-900 dark:text-white'>
+ Frequently Asked Questions
+ </h2>
+
+ <FAQ items={FAQ_ITEMS} withStructuredData />
+ </div>
+
+ <DitchGoogle />
+ </div>
+
+ <aside className='hidden lg:sticky lg:top-12 lg:block lg:w-64 lg:shrink-0 lg:self-start'>
+ <ToolsNav />
+ </aside>
+ </div>
+ </main>
+ </div>
+ )
+}
diff --git a/web/app/routes/tools.percentage-calculator.tsx b/web/app/routes/tools.percentage-calculator.tsx
new file mode 100644
index 000000000..323bcfe66
--- /dev/null
+++ b/web/app/routes/tools.percentage-calculator.tsx
@@ -0,0 +1,568 @@
+import { ArrowsLeftRightIcon } from '@phosphor-icons/react'
+import { useState } from 'react'
+import type { MetaFunction } from 'react-router'
+import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
+import { DitchGoogle } from '~/components/marketing/DitchGoogle'
+import { ToolsNav, ToolsNavMobile } from '~/components/ToolsNav'
+import { getOgImageUrl, isSelfhosted } from '~/lib/constants'
+import Button from '~/ui/Button'
+import Input from '~/ui/Input'
+import { FAQ } from '~/ui/FAQ'
+import { Text } from '~/ui/Text'
+import { getDescription, getPreviewImage, getTitle } from '~/utils/seo'
+
+export const meta: MetaFunction = () => {
+ const title = 'Free Percentage Calculator - Calculate Percentages Instantly'
+ const description =
+ 'Calculate percentages with ease. Find what X% of Y is, what percentage X is of Y, or the percentage change between two numbers. Free, fast, and no signup required.'
+ return [
+ ...getTitle(title),
+ ...getDescription(description),
+ ...getPreviewImage(getOgImageUrl(title, description)),
+ ]
+}
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 0.8,
+ exclude: isSelfhosted,
+})
+
+export async function loader() {
+ if (isSelfhosted) {
+ return redirect('/login', 302)
+ }
+
+ return null
+}
+
+const FAQ_ITEMS = [
+ {
+ question: 'How do I calculate a percentage of a number?',
+ answer:
+ 'To find X% of Y, multiply Y by X and divide by 100. For example, 25% of 200 is (200 × 25) ÷ 100 = 50. You can use our calculator above to compute this instantly.',
+ },
+ {
+ question: 'How do I find what percentage one number is of another?',
+ answer:
+ 'To find what percentage X is of Y, divide X by Y and multiply by 100. For example, 30 is what percent of 150? (30 ÷ 150) × 100 = 20%. This tells you 30 is 20% of 150.',
+ },
+ {
+ question: 'How do I calculate percentage change?',
+ answer:
+ 'Percentage change is calculated with the formula: ((New Value - Old Value) ÷ Old Value) × 100. A positive result means an increase, while a negative result means a decrease. For example, going from 80 to 100 is a 25% increase.',
+ },
+ {
+ question: 'What is the difference between percentage and percentile?',
+ answer:
+ 'A percentage is a fraction expressed out of 100 (e.g., 85% on a test means 85 out of 100). A percentile indicates a value below which a given percentage of data falls (e.g., the 90th percentile means you scored better than 90% of test-takers).',
+ },
+ {
+ question: 'How do I calculate a percentage increase?',
+ answer:
+ 'To calculate percentage increase: ((New Value - Original Value) ÷ Original Value) × 100. For example, if sales went from $10,000 to $15,000, the percentage increase is ((15000 - 10000) ÷ 10000) × 100 = 50% increase.',
+ },
+ {
+ question: 'How do I calculate a percentage decrease?',
+ answer:
+ 'To calculate percentage decrease: ((Original Value - New Value) ÷ Original Value) × 100. For example, if traffic dropped from 5,000 to 3,500 visitors, the decrease is ((5000 - 3500) ÷ 5000) × 100 = 30% decrease.',
+ },
+ {
+ question: 'How are percentages used in marketing analytics?',
+ answer:
+ 'Percentages are fundamental to marketing analytics. Click-through rate (CTR), conversion rate, bounce rate, churn rate, revenue growth rate, and market share are all expressed as percentages. Understanding percentage calculations helps you interpret KPIs and make data-driven decisions.',
+ },
+ {
+ question: 'How do I convert a fraction to a percentage?',
+ answer:
+ 'To convert a fraction to a percentage, divide the numerator by the denominator and multiply by 100. For example, 3/4 = (3 ÷ 4) × 100 = 75%. To convert a decimal to a percentage, multiply by 100 (e.g., 0.85 = 85%).',
+ },
+]
+
+type Mode = 'of' | 'is' | 'change'
+
+interface OfInputs {
+ percent: string
+ number: string
+}
+
+interface IsInputs {
+ value: string
+ total: string
+}
+
+interface ChangeInputs {
+ oldValue: string
+ newValue: string
+}
+
+const MODES: { id: Mode; label: string; description: string }[] = [
+ { id: 'of', label: 'X% of Y', description: 'What is' },
+ { id: 'is', label: 'X is what % of Y', description: 'Find percent' },
+ { id: 'change', label: '% Change', description: 'From X to Y' },
+]
+
+export default function PercentageCalculator() {
+ const [mode, setMode] = useState<Mode>('of')
+
+ const [ofInputs, setOfInputs] = useState<OfInputs>({
+ percent: '',
+ number: '',
+ })
+ const [ofResult, setOfResult] = useState<number | null>(null)
+
+ const [isInputs, setIsInputs] = useState<IsInputs>({ value: '', total: '' })
+ const [isResult, setIsResult] = useState<number | null>(null)
+
+ const [changeInputs, setChangeInputs] = useState<ChangeInputs>({
+ oldValue: '',
+ newValue: '',
+ })
+ const [changeResult, setChangeResult] = useState<{
+ percent: number
+ direction: 'increase' | 'decrease'
+ } | null>(null)
+
+ const handleOfChange = (key: keyof OfInputs, value: string) => {
+ const newInputs = { ...ofInputs, [key]: value }
+ setOfInputs(newInputs)
+
+ const percent = parseFloat(newInputs.percent)
+ const number = parseFloat(newInputs.number)
+
+ if (!isNaN(percent) && !isNaN(number)) {
+ setOfResult((number * percent) / 100)
+ } else {
+ setOfResult(null)
+ }
+ }
+
+ const handleIsChange = (key: keyof IsInputs, value: string) => {
+ const newInputs = { ...isInputs, [key]: value }
+ setIsInputs(newInputs)
+
+ const val = parseFloat(newInputs.value)
+ const total = parseFloat(newInputs.total)
+
+ if (!isNaN(val) && !isNaN(total) && total !== 0) {
+ setIsResult((val / total) * 100)
+ } else {
+ setIsResult(null)
+ }
+ }
+
+ const handleChangeChange = (key: keyof ChangeInputs, value: string) => {
+ const newInputs = { ...changeInputs, [key]: value }
+ setChangeInputs(newInputs)
+
+ const oldVal = parseFloat(newInputs.oldValue)
+ const newVal = parseFloat(newInputs.newValue)
+
+ if (!isNaN(oldVal) && !isNaN(newVal) && oldVal !== 0) {
+ const percent = ((newVal - oldVal) / Math.abs(oldVal)) * 100
+ setChangeResult({
+ percent: Math.abs(percent),
+ direction: percent >= 0 ? 'increase' : 'decrease',
+ })
+ } else {
+ setChangeResult(null)
+ }
+ }
+
+ const reset = () => {
+ setOfInputs({ percent: '', number: '' })
+ setOfResult(null)
+ setIsInputs({ value: '', total: '' })
+ setIsResult(null)
+ setChangeInputs({ oldValue: '', newValue: '' })
+ setChangeResult(null)
+ }
+
+ const formatNumber = (n: number) => {
+ if (Number.isInteger(n)) return n.toLocaleString()
+ return n.toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 4,
+ })
+ }
+
+ return (
+ <div className='min-h-screen bg-gray-50 dark:bg-slate-950'>
+ <main className='mx-auto max-w-7xl px-4 py-12 sm:px-6 lg:px-8'>
+ <ToolsNavMobile className='mb-6 lg:hidden' />
+
+ <div className='lg:flex lg:items-start lg:gap-8'>
+ <div className='min-w-0 lg:flex-1'>
+ <Text as='h1' size='4xl' weight='bold' tracking='tight'>
+ Percentage Calculator
+ </Text>
+ <Text as='p' size='lg' colour='muted' className='mt-4'>
+ Calculate percentages quickly — find X% of a number, what percent
+ one number is of another, or the percentage change between values
+ </Text>
+
+ <div className='mt-12 rounded-lg bg-white p-8 ring-1 ring-gray-200 dark:bg-slate-950 dark:ring-slate-800'>
+ <div className='space-y-6'>
+ <div className='flex gap-1 rounded-lg bg-gray-100 p-1 dark:bg-slate-900'>
+ {MODES.map((m) => (
+ <button
+ key={m.id}
+ type='button'
+ onClick={() => setMode(m.id)}
+ className={`flex-1 rounded-md px-3 py-2 text-sm font-medium transition-colors ${
+ mode === m.id
+ ? 'bg-white text-gray-900 shadow-sm dark:bg-slate-950 dark:text-white'
+ : 'text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white'
+ }`}
+ >
+ {m.label}
+ </button>
+ ))}
+ </div>
+
+ {mode === 'of' && (
+ <div>
+ <h2 className='mb-6 text-2xl font-semibold text-gray-900 dark:text-white'>
+ What is X% of Y?
+ </h2>
+
+ <div className='flex items-end gap-3'>
+ <div className='flex-1'>
+ <Input
+ type='number'
+ placeholder='25'
+ label='Percentage'
+ value={ofInputs.percent}
+ onChange={(e) =>
+ handleOfChange('percent', e.target.value)
+ }
+ className='w-full'
+ />
+ </div>
+ <div className='flex h-[42px] items-center pb-0.5 text-lg font-medium text-gray-500 dark:text-gray-400'>
+ % of
+ </div>
+ <div className='flex-1'>
+ <Input
+ type='number'
+ placeholder='200'
+ label='Number'
+ value={ofInputs.number}
+ onChange={(e) =>
+ handleOfChange('number', e.target.value)
+ }
+ className='w-full'
+ />
+ </div>
+ </div>
+
+ <div className='mt-6'>
+ <Button onClick={reset} secondary regular>
+ Reset
+ </Button>
+ </div>
+
+ {ofResult !== null ? (
+ <div className='mt-6 border-t border-gray-200 pt-6 dark:border-gray-700'>
+ <div className='rounded-lg bg-gray-50 p-6 dark:bg-slate-900'>
+ <div className='text-center'>
+ <div className='text-sm font-medium text-gray-500 dark:text-gray-400'>
+ {ofInputs.percent}% of {ofInputs.number} is
+ </div>
+ <div className='mt-2 text-5xl font-bold text-gray-900 dark:text-white'>
+ {formatNumber(ofResult)}
+ </div>
+ </div>
+
+ <div className='mt-6 rounded-lg bg-white p-4 text-sm dark:bg-slate-950'>
+ <div className='text-gray-500 dark:text-gray-400'>
+ Formula
+ </div>
+ <div className='mt-1 font-mono text-gray-900 dark:text-white'>
+ ({ofInputs.number} × {ofInputs.percent}) ÷ 100 ={' '}
+ {formatNumber(ofResult)}
+ </div>
+ </div>
+ </div>
+ </div>
+ ) : null}
+ </div>
+ )}
+
+ {mode === 'is' && (
+ <div>
+ <h2 className='mb-6 text-2xl font-semibold text-gray-900 dark:text-white'>
+ X is what percent of Y?
+ </h2>
+
+ <div className='flex items-end gap-3'>
+ <div className='flex-1'>
+ <Input
+ type='number'
+ placeholder='30'
+ label='Value'
+ value={isInputs.value}
+ onChange={(e) =>
+ handleIsChange('value', e.target.value)
+ }
+ className='w-full'
+ />
+ </div>
+ <div className='flex h-[42px] items-center pb-0.5 text-lg font-medium text-gray-500 dark:text-gray-400'>
+ is what % of
+ </div>
+ <div className='flex-1'>
+ <Input
+ type='number'
+ placeholder='150'
+ label='Total'
+ value={isInputs.total}
+ onChange={(e) =>
+ handleIsChange('total', e.target.value)
+ }
+ className='w-full'
+ />
+ </div>
+ </div>
+
+ <div className='mt-6'>
+ <Button onClick={reset} secondary regular>
+ Reset
+ </Button>
+ </div>
+
+ {isResult !== null ? (
+ <div className='mt-6 border-t border-gray-200 pt-6 dark:border-gray-700'>
+ <div className='rounded-lg bg-gray-50 p-6 dark:bg-slate-900'>
+ <div className='text-center'>
+ <div className='text-sm font-medium text-gray-500 dark:text-gray-400'>
+ {isInputs.value} is this percentage of{' '}
+ {isInputs.total}
+ </div>
+ <div className='mt-2 text-5xl font-bold text-gray-900 dark:text-white'>
+ {isResult.toFixed(2)}%
+ </div>
+ </div>
+
+ <div className='mt-6 rounded-lg bg-white p-4 text-sm dark:bg-slate-950'>
+ <div className='text-gray-500 dark:text-gray-400'>
+ Formula
+ </div>
+ <div className='mt-1 font-mono text-gray-900 dark:text-white'>
+ ({isInputs.value} ÷ {isInputs.total}) × 100 ={' '}
+ {isResult.toFixed(2)}%
+ </div>
+ </div>
+ </div>
+ </div>
+ ) : null}
+ </div>
+ )}
+
+ {mode === 'change' && (
+ <div>
+ <h2 className='mb-6 text-2xl font-semibold text-gray-900 dark:text-white'>
+ Percentage Change
+ </h2>
+
+ <div className='flex items-end gap-3'>
+ <div className='flex-1'>
+ <Input
+ type='number'
+ placeholder='80'
+ label='Old Value'
+ value={changeInputs.oldValue}
+ onChange={(e) =>
+ handleChangeChange('oldValue', e.target.value)
+ }
+ className='w-full'
+ />
+ </div>
+ <div className='flex h-[42px] items-center pb-0.5'>
+ <ArrowsLeftRightIcon className='h-5 w-5 text-gray-400 dark:text-gray-500' />
+ </div>
+ <div className='flex-1'>
+ <Input
+ type='number'
+ placeholder='100'
+ label='New Value'
+ value={changeInputs.newValue}
+ onChange={(e) =>
+ handleChangeChange('newValue', e.target.value)
+ }
+ className='w-full'
+ />
+ </div>
+ </div>
+
+ <div className='mt-6'>
+ <Button onClick={reset} secondary regular>
+ Reset
+ </Button>
+ </div>
+
+ {changeResult !== null ? (
+ <div className='mt-6 border-t border-gray-200 pt-6 dark:border-gray-700'>
+ <div className='rounded-lg bg-gray-50 p-6 dark:bg-slate-900'>
+ <div className='text-center'>
+ <div className='text-sm font-medium text-gray-500 dark:text-gray-400'>
+ Change from {changeInputs.oldValue} to{' '}
+ {changeInputs.newValue}
+ </div>
+ <div
+ className={`mt-2 text-5xl font-bold ${
+ changeResult.direction === 'increase'
+ ? 'text-green-600 dark:text-green-400'
+ : 'text-red-600 dark:text-red-400'
+ }`}
+ >
+ {changeResult.direction === 'increase'
+ ? '+'
+ : '-'}
+ {changeResult.percent.toFixed(2)}%
+ </div>
+ <div className='mt-2 text-lg text-gray-600 dark:text-gray-400'>
+ {changeResult.direction === 'increase'
+ ? 'Increase'
+ : 'Decrease'}
+ </div>
+ </div>
+
+ <div className='mt-6 rounded-lg bg-white p-4 text-sm dark:bg-slate-950'>
+ <div className='text-gray-500 dark:text-gray-400'>
+ Formula
+ </div>
+ <div className='mt-1 font-mono text-gray-900 dark:text-white'>
+ (({changeInputs.newValue} -{' '}
+ {changeInputs.oldValue}) ÷ |
+ {changeInputs.oldValue}|) × 100 ={' '}
+ {changeResult.direction === 'increase'
+ ? '+'
+ : '-'}
+ {changeResult.percent.toFixed(2)}%
+ </div>
+ </div>
+ </div>
+ </div>
+ ) : null}
+ </div>
+ )}
+ </div>
+ </div>
+
+ <section className='mt-20 border-t border-gray-200 pt-16 dark:border-slate-700'>
+ <Text as='h2' size='3xl' weight='bold' tracking='tight'>
+ Free Percentage Calculator Online
+ </Text>
+ <Text
+ as='p'
+ size='lg'
+ colour='muted'
+ className='mt-4 leading-relaxed'
+ >
+ Our free percentage calculator helps you solve the three most
+ common percentage problems instantly: finding a percentage of a
+ number, determining what percent one number is of another, and
+ calculating the percentage change between two values. Whether
+ you are analyzing marketing metrics, calculating discounts,
+ tracking growth rates, or working with financial data, this tool
+ gives you accurate results in seconds.
+ </Text>
+
+ <div className='mt-12 grid gap-x-12 gap-y-10 md:grid-cols-2'>
+ <div>
+ <Text as='h3' size='xl' weight='semibold'>
+ Common Uses for Percentages
+ </Text>
+ <ul className='mt-3 space-y-2'>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Marketing analytics
+ </Text>{' '}
+ - Calculate conversion rates, click-through rates,
+ bounce rates, and churn rates to measure campaign
+ performance.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Business growth
+ </Text>{' '}
+ - Track revenue growth, user acquisition rates, and
+ month-over-month percentage changes for data-driven
+ decisions.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Pricing & discounts
+ </Text>{' '}
+ - Calculate sale prices, markups, margins, and the
+ impact of promotional discounts on revenue.
+ </Text>
+ </li>
+ </ul>
+ </div>
+ <div>
+ <Text as='h3' size='xl' weight='semibold'>
+ Percentage Tips
+ </Text>
+ <ul className='mt-3 space-y-2'>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Percentage trick
+ </Text>{' '}
+ - X% of Y always equals Y% of X. So 8% of 50 is the same
+ as 50% of 8 (both are 4). Use whichever is easier to
+ calculate.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Percentage points vs. percent
+ </Text>{' '}
+ - Going from 5% to 10% is a 5 percentage point increase,
+ but a 100% increase in relative terms. Be precise in
+ your communication.
+ </Text>
+ </li>
+ <li>
+ <Text colour='muted'>
+ <Text as='span' weight='semibold' colour='inherit'>
+ Compound growth
+ </Text>{' '}
+ - Repeated percentage increases compound. A 10% increase
+ followed by another 10% increase results in 21% total
+ growth, not 20%.
+ </Text>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </section>
+
+ <div className='mt-16'>
+ <h2 className='mb-8 text-center text-3xl font-bold text-gray-900 dark:text-white'>
+ Frequently Asked Questions
+ </h2>
+
+ <FAQ items={FAQ_ITEMS} withStructuredData />
+ </div>
+
+ <DitchGoogle />
+ </div>
+
+ <aside className='hidden lg:sticky lg:top-12 lg:block lg:w-64 lg:shrink-0 lg:self-start'>
+ <ToolsNav />
+ </aside>
+ </div>
+ </main>
+ </div>
+ )
+}