Social Media Icons: Best Size, Color and Spacing Tested

Use a 20 to 24 px icon in a 40 px link with an 8 px gap. We ran the sizes through axe, measured 13 brand colors and read the official logo rules.

Amit Yadav
14 min read
On this page

Use a 20 to 24 px icon inside a 40 px link box, with an 8 px gap between links. Keep the icons one neutral color by default, and only use a brand color on hover where it stays readable on your background.

We tested that against axe-core in Chrome, measured 13 brand colors on white and on a dark footer, and read the official logo rules of the main platforms. Some of the results contradict the advice this post gave before, so those parts are corrected below.

Quick answer

  • Size: 20 to 24 px icon in a 40 px link box. A 16 px icon link with no padding fails the WCAG target size check unless the gap is 8 px or more.
  • Color: one neutral color by default. WhatsApp and Telegram fall under 3:1 on white. X, Threads, TikTok and GitHub fall under 3:1 on a dark footer.
  • Pack: Bootstrap Icons and Remix cover all 12 platforms we tested, with one viewBox and currentColor built in. Simple Icons no longer ships LinkedIn on npm.
  • Rules: LinkedIn, WhatsApp and Discord limit recoloring. A gray logo is common, but it sits outside what those guides list.
  • Trap: axe does not check icon contrast. A pass does not mean the icon is readable.

The snippet to copy

This is the exact code we tested at a 390 px viewport. Axe reported no violations for target size, link names and list structure. Each link measured 40 x 40 px with the 20 px icon centered, and keyboard focus showed a 2 px outline.

<nav aria-label="Social links">
  <ul class="social">
    <li>
      <a href="https://x.com/you" aria-label="X">
        <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><!-- path --></svg>
      </a>
    </li>
    <li>
      <a href="https://linkedin.com/in/you" aria-label="LinkedIn" style="--brand:#0a66c2">
        <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><!-- path --></svg>
      </a>
    </li>
  </ul>
</nav>
.social { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.social a {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 8px;
  color: #52525b;
  transition: color .15s, background-color .15s;
}
.social a:hover {
  color: var(--brand, currentColor);
  background: color-mix(in oklab, currentColor 10%, transparent);
}
.social a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .social a { transition: none; } }

Two choices in it are deliberate:

  • --brand is opt-in per link. X, WhatsApp and Telegram get no --brand on a white page, so they stay on the readable neutral color. WhatsApp's green is 1.98:1 on white.
  • The box does the work, not the icon. The 40 px box plus the 8 px gap puts link centers 48 px apart. The icon can be 20 or 24 px without changing the layout.

On a dark footer, use #a1a1aa as the default (6.91:1 on #18181b, against 7.73:1 for #52525b on white) and remove --brand from X, Threads, TikTok and GitHub. We calculated those dark footer ratios; we ran the snippet itself in the light version only.

If your audience is mostly on phones, 44 px boxes meet the stricter WCAG 2.5.5 target size at level AAA.

What size passes the target check

WCAG 2.5.8 at level AA asks for a 24 x 24 CSS px target, or enough spacing around a smaller one. We ran icon links with no padding through the axe-core target-size rule at each size and gap.

Icon link sizeGap 0Gap 2 pxGap 4 pxGap 8 px
16 pxFailFailFailPass
20 pxFailFailPassPass
24 pxPassPassPassPass
32 pxPassPassPassPass

Padding fixes small icons in the same way. With a 16 px icon and no gap, 0 and 2 px of padding fail (16 and 20 px targets), and 4 and 8 px pass (24 and 32 px targets).

So the old advice here, a 16 to 24 px gap between 24 px links, was more than the rule needs. 24 px passes at any gap. It is still too small to tap comfortably, which is why the snippet uses a 40 px box.

Why not a 16 px icon

Passing the check does not make the icon clear. We rendered all 12 logos at each size and counted the share of inked pixels that came out at 90% darkness or more. A low share means soft, blurry edges.

Pack16 px20 px24 px32 px
Simple Icons0.520.590.650.73
Font Awesome0.530.570.630.73
Bootstrap Icons0.560.610.660.74
Tabler (outline)0.280.370.550.56
Remix0.510.590.690.73

Those numbers are for a 1x screen. On a 2x screen a 16 px icon draws like 32 px on 1x, so the problem is mostly on desktop monitors. Tabler draws its logos as outlines, and at 16 px on 1x barely a quarter of its pixels are solid. Use its logos at 24 px or larger.

A shared viewBox does not make icons match

This post used to say that a uniform 0 0 24 24 viewBox makes icons align. Centering holds: the largest offset we measured was 2.1% of the icon box, about 0.4 px at 20 px. Visual weight does not hold.

The same 12 social logos drawn by Simple Icons, Font Awesome, Bootstrap Icons, Tabler and Remix. Simple Icons shows none for LinkedIn. Tabler draws outlines, the others mostly solid shapes.

We measured how much of the box each logo actually fills.

PackPlatforms (of 12)viewBoxColor hookInk area
Simple Icons11, no LinkedIn24Add it yourself25% to 67%
Font Awesome brands12Varies by iconAdd it yourself26% to 63%
Bootstrap Icons1216fill currentColor27% to 76%
Tabler1224stroke currentColor22% to 34%
Remix1224fill currentColor22% to 55%

In Simple Icons, the Telegram disc covers 67% of its box and the X covers 25%. Set side by side at the same size, the X looks smaller. Most solid packs have a gap of about 2.5x between their lightest and heaviest logo. Tabler is the most even because everything is an outline, but it is also the weakest at small sizes.

What to do with that:

  • Pick one pack for the whole row. Mixing packs is what makes a row look wrong, because stroke and fill styles differ as well as weight.
  • Default to Bootstrap Icons or Remix when you need every platform and want currentColor without editing the file.
  • Use Simple Icons when you need many brands or its hex values, and add fill="currentColor" yourself. Version 16.36.0 on npm has no LinkedIn file. Our cached copy of the pack still lists one, and we did not trace why, so check before you rely on it.
  • Skip Lucide for this job. It covered 1 of the 12 platforms, because Lucide does not accept brand logos and points people to Simple Icons.

Font Awesome's viewBox changes per icon (448 x 512, 576 x 512, 512 x 512). A square width and height still centers them, but the narrower ones draw smaller.

Which brand colors stay readable

WCAG 1.4.11 asks for 3:1 for graphics needed to understand the content. A social icon is often the only thing that tells you where the link goes, so we read that as 3:1 in every state, including hover.

Twelve brand logos in their brand color on white and on near-black, each with its contrast ratio. WhatsApp and Telegram are flagged on white. X, Threads, TikTok and GitHub are flagged on dark.

BrandHexOn whiteOn #18181B
X, Threads, TikTok#00000021.001.19
GitHub#18171717.891.01
LinkedIn#0A66C25.693.12
Facebook#0866FF4.823.67
Discord#5865F24.613.85
Mastodon#6364FF4.384.05
YouTube#FF00004.004.43
Instagram (solid)#FF00693.854.60
Bluesky#0560FF5.093.48
Telegram#26A5E42.776.40
WhatsApp#25D3661.988.93

Bold values are under 3:1. Corrections to our old list and notes on the sources:

  • Facebook is now #0866FF, sampled from the file in Meta's kit. We used to list #1877F2.
  • Instagram has no official solid color we could find: the kit offers gradient, white and black. #FF0069 is the Simple Icons value, and our old #E1306C is the older common fallback.
  • Bluesky's branding page gives #0560FF. Simple Icons has #1185FE, which scores 3.61 on white and 4.90 on dark.
  • YouTube appears as both #FF0000 and #FF0033 around the web. We did not read YouTube's own page, so treat that one as unconfirmed.

Our Brand Colors page lists hex values for brands in the Simple Icons set.

The default gray in our old snippet failed

The old snippet here set icons to #9CA3AF by default. That is 2.54:1 on white, under the 3:1 line. Axe reported no violation for it, and it also passed an even paler #D1D5DB icon.

Axe's color contrast rule looks at text. It does not check the color of an icon-only link, so check these ratios yourself. #52525B gives 7.73:1 on white, and #6B7280 gives 4.83:1.

We also removed the old translateY(-2px) hover lift. It adds motion and nothing else, and the background tint already marks the hovered link.

What the official logo rules say

The old post warned about trademark problems without saying what the rules are. Here is what we found in each brand's own pages. This is a reading of their guides, not legal advice.

BrandSVG in the official kitRule that affects a footer row
LinkedInNone (0 of 10 files)[in] only in blue, black or white. At least 21 px tall on screen. Clear space of one [in] logo.
FacebookNone (0 of 16 files)At least 16 px wide on screen. Clear space of 1/4 of the logo width.
InstagramYes (3 of 10 files)Use only the logos from the Brand Resource Center.
WhatsAppYes (18 of 66 files)Use the official logos only. Do not change color or design.
GitHubYes (40 of 128 files)Invertocat in white or black, in few cases grey or green.
DiscordCheck the pageColor, black or white. Do not edit or recolor.
MastodonYesPurple, black or white.
TelegramNot a formal kitNo formal guidelines found, only a note about not representing Telegram officially.

Three things follow from that table:

  1. LinkedIn's minimum means 20 px is a little short. The [in] logo must be 21 px tall on screen, and a 20 px icon with internal space is under that. Use 24 px and a pack that fills the box if you want to meet the rule.
  2. A gray default is outside several guides. The row in our snippet is common practice, but LinkedIn, WhatsApp and Discord list specific colors, and gray is not one of them. To stay inside those lists, set the default to black on light pages and white on dark pages. Those are the high contrast choices too, and GitHub's guide says to use the highest contrast option when in doubt.
  3. Pack icons are redrawings. An icon pack's license covers the drawing, not the trademark, and outline versions such as Tabler's are not official artwork. When a brand team or a partner agreement is involved, use the official files.

We could not read X's brand toolkit (the page returned 403), and we found no usable rules on TikTok's page or minimum sizes for YouTube. Those three are unverified.

An icon-only link needs a name, or a screen reader only announces "link". Axe results for the five ways we tried:

Methodlink-name result
aria-label on the linkPass
<title> inside the SVGPass
Visually hidden textPass
title attribute on the linkPass
No name at allFail

Use aria-label with the platform name, and put aria-hidden="true" on the SVG. Opening in a new tab did not change the result. Our accessible SVG icons guide explains the other cases, and SVG icons for navigation menus covers icon links in larger menus.

How we tested

Checked 2026-11-05 in headless Chrome with axe-core 4.14.0 and these packages: simple-icons 16.36.0, @fortawesome/free-brands-svg-icons 7.3.1, bootstrap-icons 1.13.2, @tabler/icons 3.50.0, remixicon 4.9.1 and lucide-static 1.69.0. The 12 platforms were X, Threads, Bluesky, Mastodon, TikTok, Discord, LinkedIn, YouTube, Instagram, GitHub, WhatsApp and Telegram.

Limits of the test:

  • Chrome only, with no Firefox, Safari or real phones.
  • Automated checks only. We did not test with a screen reader or with people.
  • Ink area was measured at 240 px, and the solid pixel share comes from one render of each logo in black on white.
  • The Remix test used 4.9.1, while our /pack/ri/ page holds 4.8.0. Remix changed its license in 4.9, so read it before you upgrade.
  • Pack versions and brand pages change. Recheck the hex values and rules before a large rollout.
What size should social media icons be on a website?
Use a 20 to 24 px icon inside a 40 px link box, with an 8 px gap. A 24 px link passes the WCAG 2.5.8 target size at any gap, and a 16 px link with no padding only passes with a gap of 8 px or more.
How much space should go between social icons?
8 px between 40 px boxes puts link centers 48 px apart. If the links are the bare icon, 20 px links need at least 4 px and 16 px links need at least 8 px to pass the axe target size check.
Should social icons use brand colors?
Use black or white by default, or a neutral color if you accept that it sits outside some brand guides. Use brand colors on hover only when they reach 3:1 on your background. WhatsApp and Telegram miss that on white. X, Threads, TikTok and GitHub miss it on a dark footer.
Can I change the color of a social media logo?
Check that brand's guide first. LinkedIn allows blue, black and white. WhatsApp says not to change the color. Discord allows its color, black or white. GitHub allows white and black, and grey or green in few cases.
Which icon pack is best for social media icons?
Bootstrap Icons and Remix covered all 12 platforms in our test, with one viewBox size and currentColor built in. Simple Icons has the most brands, but its npm package no longer includes a LinkedIn file. Lucide does not accept brand logos.
Why do my social icons look different sizes when the viewBox is the same?
The viewBox only sets the box. The logos fill it differently: in Simple Icons the Telegram disc covers 67% of the box and the X covers 25%. Use one pack for the whole row, and adjust single icons by hand if the row still looks uneven.

Related posts

Share this post