Bought Pro? It is on your account. Sign in
SVG Creator Go Pro

Lock icon (free SVG)

In shortA padlock means locked, private or password-protected. Use it on password fields, private settings and paid content; pair it with an unlocked state where it toggles. Download this lock icon free in four styles as a 24×24 SVG that uses currentColor; every file is under 1 KB and free for commercial use.

Style collections: outline · filled · duotone · glyph · Updated 2026-10-21

Lock icon, outline style, on a light backgroundLock icon, outline style, on a dark background
Outline · 319 bytes
Lock icon, filled style, on a light backgroundLock icon, filled style, on a dark background
Filled · 327 bytes
Lock icon, duotone style, on a light backgroundLock icon, duotone style, on a dark background
Duotone · 425 bytes
Lock icon, glyph style, on a light backgroundLock icon, glyph style, on a dark background
Glyph · 255 bytes

Variations

The same lock drawn four ways. Open any of them in the editor to recolour it, change the stroke, rotate or export PNG.

Lock icon at 16 pixels
16px
Lock icon at 20 pixels
20px
Lock icon at 24 pixels
24px
Lock icon at 32 pixels
32px
Lock icon at 48 pixels
48px

Code

Inline SVG (HTML)

<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4.5" y="10.5" width="15" height="10.5" rx="2.5"/><path d="M8 10.5V7a4 4 0 0 1 8 0v3.5"/><circle cx="12" cy="15.8" r="1.4"/></svg>

React component

export default function LockIcon({ size = 24, color = "currentColor", ...props }) {
  return (
    <svg
      xmlns="http://www.w3.org/2000/svg"
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="none"
      stroke={color}
      strokeWidth={2}
      strokeLinecap="round"
      strokeLinejoin="round"
      {...props}
    >
      <rect x="4.5" y="10.5" width="15" height="10.5" rx="2.5" />
      <path d="M8 10.5V7a4 4 0 0 1 8 0v3.5" />
      <circle cx="12" cy="15.8" r="1.4" />
    </svg>
  );
}

CSS mask (recolour with color)

.icon-lock {
  display: inline-block;
  width: 24px;
  height: 24px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='10.5' width='15' height='10.5' rx='2.5'/%3E%3Cpath d='M8 10.5V7a4 4 0 0 1 8 0v3.5'/%3E%3Ccircle cx='12' cy='15.8' r='1.4'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='10.5' width='15' height='10.5' rx='2.5'/%3E%3Cpath d='M8 10.5V7a4 4 0 0 1 8 0v3.5'/%3E%3Ccircle cx='12' cy='15.8' r='1.4'/%3E%3C/svg%3E") no-repeat center / contain;
}

Image tag

<img src="https://mumshadjawad.com/svg-creator/icons/lock-outline.svg" width="24" height="24" alt="">

Not sure which to use? See SVG icons in React, SVG icons in CSS and how to change an SVG icon's colour.

Details

Good for
password, private, locked, secure
Grid
24 × 24, viewBox="0 0 24 24", 2px safe area
Outline stroke
2px, round caps and joins
Shapes
3 elements (outline, classic)
File sizes
outline 319 B · filled 327 B · duotone 425 B · glyph 255 B
Licence
Free for personal and commercial use, no attribution required
Collections
security and privacy icons, UI icons for apps and websites

Related icons

Need a different lock?

Describe it ("lock, minimal, rounded") and get four new variations.
Generate variations