Quick reference

Class
Properties
p-0padding: 0px;
px-0padding-left: 0px; padding-right: 0px;
py-0padding-top: 0px; padding-bottom: 0px;
pt-0padding-top: 0px;
pr-0padding-right: 0px;
pb-0padding-bottom: 0px;
pl-0padding-left: 0px;
p-pxpadding: 1px;
px-pxpadding-left: 1px; padding-right: 1px;
py-pxpadding-top: 1px; padding-bottom: 1px;
pt-pxpadding-top: 1px;
pr-pxpadding-right: 1px;
pb-pxpadding-bottom: 1px;
pl-pxpadding-left: 1px;
p-0.5padding: 0.125rem; /* 2px */
px-0.5padding-left: 0.125rem; /* 2px */ padding-right: 0.125rem; /* 2px */
py-0.5padding-top: 0.125rem; /* 2px */ padding-bottom: 0.125rem; /* 2px */
pt-0.5padding-top: 0.125rem; /* 2px */
pr-0.5padding-right: 0.125rem; /* 2px */
pb-0.5padding-bottom: 0.125rem; /* 2px */
pl-0.5padding-left: 0.125rem; /* 2px */
p-1padding: 0.25rem; /* 4px */
px-1padding-left: 0.25rem; /* 4px */ padding-right: 0.25rem; /* 4px */
py-1padding-top: 0.25rem; /* 4px */ padding-bottom: 0.25rem; /* 4px */
pt-1padding-top: 0.25rem; /* 4px */
pr-1padding-right: 0.25rem; /* 4px */
pb-1padding-bottom: 0.25rem; /* 4px */
pl-1padding-left: 0.25rem; /* 4px */
p-1.5padding: 0.375rem; /* 6px */
px-1.5padding-left: 0.375rem; /* 6px */ padding-right: 0.375rem; /* 6px */
py-1.5padding-top: 0.375rem; /* 6px */ padding-bottom: 0.375rem; /* 6px */
pt-1.5padding-top: 0.375rem; /* 6px */
pr-1.5padding-right: 0.375rem; /* 6px */
pb-1.5padding-bottom: 0.375rem; /* 6px */
pl-1.5padding-left: 0.375rem; /* 6px */
p-2padding: 0.5rem; /* 8px */
px-2padding-left: 0.5rem; /* 8px */ padding-right: 0.5rem; /* 8px */
py-2padding-top: 0.5rem; /* 8px */ padding-bottom: 0.5rem; /* 8px */
pt-2padding-top: 0.5rem; /* 8px */
pr-2padding-right: 0.5rem; /* 8px */
pb-2padding-bottom: 0.5rem; /* 8px */
pl-2padding-left: 0.5rem; /* 8px */
p-2.5padding: 0.625rem; /* 10px */
px-2.5padding-left: 0.625rem; /* 10px */ padding-right: 0.625rem; /* 10px */
py-2.5padding-top: 0.625rem; /* 10px */ padding-bottom: 0.625rem; /* 10px */
pt-2.5padding-top: 0.625rem; /* 10px */
pr-2.5padding-right: 0.625rem; /* 10px */
pb-2.5padding-bottom: 0.625rem; /* 10px */
pl-2.5padding-left: 0.625rem; /* 10px */
p-3padding: 0.75rem; /* 12px */
px-3padding-left: 0.75rem; /* 12px */ padding-right: 0.75rem; /* 12px */
py-3padding-top: 0.75rem; /* 12px */ padding-bottom: 0.75rem; /* 12px */
pt-3padding-top: 0.75rem; /* 12px */
pr-3padding-right: 0.75rem; /* 12px */
pb-3padding-bottom: 0.75rem; /* 12px */
pl-3padding-left: 0.75rem; /* 12px */
p-3.5padding: 0.875rem; /* 14px */
px-3.5padding-left: 0.875rem; /* 14px */ padding-right: 0.875rem; /* 14px */
py-3.5padding-top: 0.875rem; /* 14px */ padding-bottom: 0.875rem; /* 14px */
pt-3.5padding-top: 0.875rem; /* 14px */
pr-3.5padding-right: 0.875rem; /* 14px */
pb-3.5padding-bottom: 0.875rem; /* 14px */
pl-3.5padding-left: 0.875rem; /* 14px */
p-4padding: 1rem; /* 16px */
px-4padding-left: 1rem; /* 16px */ padding-right: 1rem; /* 16px */
py-4padding-top: 1rem; /* 16px */ padding-bottom: 1rem; /* 16px */
pt-4padding-top: 1rem; /* 16px */
pr-4padding-right: 1rem; /* 16px */
pb-4padding-bottom: 1rem; /* 16px */
pl-4padding-left: 1rem; /* 16px */
p-5padding: 1.25rem; /* 20px */
px-5padding-left: 1.25rem; /* 20px */ padding-right: 1.25rem; /* 20px */
py-5padding-top: 1.25rem; /* 20px */ padding-bottom: 1.25rem; /* 20px */
pt-5padding-top: 1.25rem; /* 20px */
pr-5padding-right: 1.25rem; /* 20px */
pb-5padding-bottom: 1.25rem; /* 20px */
pl-5padding-left: 1.25rem; /* 20px */
p-6padding: 1.5rem; /* 24px */
px-6padding-left: 1.5rem; /* 24px */ padding-right: 1.5rem; /* 24px */
py-6padding-top: 1.5rem; /* 24px */ padding-bottom: 1.5rem; /* 24px */
pt-6padding-top: 1.5rem; /* 24px */
pr-6padding-right: 1.5rem; /* 24px */
pb-6padding-bottom: 1.5rem; /* 24px */
pl-6padding-left: 1.5rem; /* 24px */
p-7padding: 1.75rem; /* 28px */
px-7padding-left: 1.75rem; /* 28px */ padding-right: 1.75rem; /* 28px */
py-7padding-top: 1.75rem; /* 28px */ padding-bottom: 1.75rem; /* 28px */
pt-7padding-top: 1.75rem; /* 28px */
pr-7padding-right: 1.75rem; /* 28px */
pb-7padding-bottom: 1.75rem; /* 28px */
pl-7padding-left: 1.75rem; /* 28px */
p-8padding: 2rem; /* 32px */
px-8padding-left: 2rem; /* 32px */ padding-right: 2rem; /* 32px */
py-8padding-top: 2rem; /* 32px */ padding-bottom: 2rem; /* 32px */
pt-8padding-top: 2rem; /* 32px */
pr-8padding-right: 2rem; /* 32px */
pb-8padding-bottom: 2rem; /* 32px */
pl-8padding-left: 2rem; /* 32px */
p-9padding: 2.25rem; /* 36px */
px-9padding-left: 2.25rem; /* 36px */ padding-right: 2.25rem; /* 36px */
py-9padding-top: 2.25rem; /* 36px */ padding-bottom: 2.25rem; /* 36px */
pt-9padding-top: 2.25rem; /* 36px */
pr-9padding-right: 2.25rem; /* 36px */
pb-9padding-bottom: 2.25rem; /* 36px */
pl-9padding-left: 2.25rem; /* 36px */
p-10padding: 2.5rem; /* 40px */
px-10padding-left: 2.5rem; /* 40px */ padding-right: 2.5rem; /* 40px */
py-10padding-top: 2.5rem; /* 40px */ padding-bottom: 2.5rem; /* 40px */
pt-10padding-top: 2.5rem; /* 40px */
pr-10padding-right: 2.5rem; /* 40px */
pb-10padding-bottom: 2.5rem; /* 40px */
pl-10padding-left: 2.5rem; /* 40px */
p-11padding: 2.75rem; /* 44px */
px-11padding-left: 2.75rem; /* 44px */ padding-right: 2.75rem; /* 44px */
py-11padding-top: 2.75rem; /* 44px */ padding-bottom: 2.75rem; /* 44px */
pt-11padding-top: 2.75rem; /* 44px */
pr-11padding-right: 2.75rem; /* 44px */
pb-11padding-bottom: 2.75rem; /* 44px */
pl-11padding-left: 2.75rem; /* 44px */
p-12padding: 3rem; /* 48px */
px-12padding-left: 3rem; /* 48px */ padding-right: 3rem; /* 48px */
py-12padding-top: 3rem; /* 48px */ padding-bottom: 3rem; /* 48px */
pt-12padding-top: 3rem; /* 48px */
pr-12padding-right: 3rem; /* 48px */
pb-12padding-bottom: 3rem; /* 48px */
pl-12padding-left: 3rem; /* 48px */
p-14padding: 3.5rem; /* 56px */
px-14padding-left: 3.5rem; /* 56px */ padding-right: 3.5rem; /* 56px */
py-14padding-top: 3.5rem; /* 56px */ padding-bottom: 3.5rem; /* 56px */
pt-14padding-top: 3.5rem; /* 56px */
pr-14padding-right: 3.5rem; /* 56px */
pb-14padding-bottom: 3.5rem; /* 56px */
pl-14padding-left: 3.5rem; /* 56px */
p-16padding: 4rem; /* 64px */
px-16padding-left: 4rem; /* 64px */ padding-right: 4rem; /* 64px */
py-16padding-top: 4rem; /* 64px */ padding-bottom: 4rem; /* 64px */
pt-16padding-top: 4rem; /* 64px */
pr-16padding-right: 4rem; /* 64px */
pb-16padding-bottom: 4rem; /* 64px */
pl-16padding-left: 4rem; /* 64px */
p-20padding: 5rem; /* 80px */
px-20padding-left: 5rem; /* 80px */ padding-right: 5rem; /* 80px */
py-20padding-top: 5rem; /* 80px */ padding-bottom: 5rem; /* 80px */
pt-20padding-top: 5rem; /* 80px */
pr-20padding-right: 5rem; /* 80px */
pb-20padding-bottom: 5rem; /* 80px */
pl-20padding-left: 5rem; /* 80px */
p-24padding: 6rem; /* 96px */
px-24padding-left: 6rem; /* 96px */ padding-right: 6rem; /* 96px */
py-24padding-top: 6rem; /* 96px */ padding-bottom: 6rem; /* 96px */
pt-24padding-top: 6rem; /* 96px */
pr-24padding-right: 6rem; /* 96px */
pb-24padding-bottom: 6rem; /* 96px */
pl-24padding-left: 6rem; /* 96px */
p-28padding: 7rem; /* 112px */
px-28padding-left: 7rem; /* 112px */ padding-right: 7rem; /* 112px */
py-28padding-top: 7rem; /* 112px */ padding-bottom: 7rem; /* 112px */
pt-28padding-top: 7rem; /* 112px */
pr-28padding-right: 7rem; /* 112px */
pb-28padding-bottom: 7rem; /* 112px */
pl-28padding-left: 7rem; /* 112px */
p-32padding: 8rem; /* 128px */
px-32padding-left: 8rem; /* 128px */ padding-right: 8rem; /* 128px */
py-32padding-top: 8rem; /* 128px */ padding-bottom: 8rem; /* 128px */
pt-32padding-top: 8rem; /* 128px */
pr-32padding-right: 8rem; /* 128px */
pb-32padding-bottom: 8rem; /* 128px */
pl-32padding-left: 8rem; /* 128px */
p-36padding: 9rem; /* 144px */
px-36padding-left: 9rem; /* 144px */ padding-right: 9rem; /* 144px */
py-36padding-top: 9rem; /* 144px */ padding-bottom: 9rem; /* 144px */
pt-36padding-top: 9rem; /* 144px */
pr-36padding-right: 9rem; /* 144px */
pb-36padding-bottom: 9rem; /* 144px */
pl-36padding-left: 9rem; /* 144px */
p-40padding: 10rem; /* 160px */
px-40padding-left: 10rem; /* 160px */ padding-right: 10rem; /* 160px */
py-40padding-top: 10rem; /* 160px */ padding-bottom: 10rem; /* 160px */
pt-40padding-top: 10rem; /* 160px */
pr-40padding-right: 10rem; /* 160px */
pb-40padding-bottom: 10rem; /* 160px */
pl-40padding-left: 10rem; /* 160px */
p-44padding: 11rem; /* 176px */
px-44padding-left: 11rem; /* 176px */ padding-right: 11rem; /* 176px */
py-44padding-top: 11rem; /* 176px */ padding-bottom: 11rem; /* 176px */
pt-44padding-top: 11rem; /* 176px */
pr-44padding-right: 11rem; /* 176px */
pb-44padding-bottom: 11rem; /* 176px */
pl-44padding-left: 11rem; /* 176px */
p-48padding: 12rem; /* 192px */
px-48padding-left: 12rem; /* 192px */ padding-right: 12rem; /* 192px */
py-48padding-top: 12rem; /* 192px */ padding-bottom: 12rem; /* 192px */
pt-48padding-top: 12rem; /* 192px */
pr-48padding-right: 12rem; /* 192px */
pb-48padding-bottom: 12rem; /* 192px */
pl-48padding-left: 12rem; /* 192px */
p-52padding: 13rem; /* 208px */
px-52padding-left: 13rem; /* 208px */ padding-right: 13rem; /* 208px */
py-52padding-top: 13rem; /* 208px */ padding-bottom: 13rem; /* 208px */
pt-52padding-top: 13rem; /* 208px */
pr-52padding-right: 13rem; /* 208px */
pb-52padding-bottom: 13rem; /* 208px */
pl-52padding-left: 13rem; /* 208px */
p-56padding: 14rem; /* 224px */
px-56padding-left: 14rem; /* 224px */ padding-right: 14rem; /* 224px */
py-56padding-top: 14rem; /* 224px */ padding-bottom: 14rem; /* 224px */
pt-56padding-top: 14rem; /* 224px */
pr-56padding-right: 14rem; /* 224px */
pb-56padding-bottom: 14rem; /* 224px */
pl-56padding-left: 14rem; /* 224px */
p-60padding: 15rem; /* 240px */
px-60padding-left: 15rem; /* 240px */ padding-right: 15rem; /* 240px */
py-60padding-top: 15rem; /* 240px */ padding-bottom: 15rem; /* 240px */
pt-60padding-top: 15rem; /* 240px */
pr-60padding-right: 15rem; /* 240px */
pb-60padding-bottom: 15rem; /* 240px */
pl-60padding-left: 15rem; /* 240px */
p-64padding: 16rem; /* 256px */
px-64padding-left: 16rem; /* 256px */ padding-right: 16rem; /* 256px */
py-64padding-top: 16rem; /* 256px */ padding-bottom: 16rem; /* 256px */
pt-64padding-top: 16rem; /* 256px */
pr-64padding-right: 16rem; /* 256px */
pb-64padding-bottom: 16rem; /* 256px */
pl-64padding-left: 16rem; /* 256px */
p-72padding: 18rem; /* 288px */
px-72padding-left: 18rem; /* 288px */ padding-right: 18rem; /* 288px */
py-72padding-top: 18rem; /* 288px */ padding-bottom: 18rem; /* 288px */
pt-72padding-top: 18rem; /* 288px */
pr-72padding-right: 18rem; /* 288px */
pb-72padding-bottom: 18rem; /* 288px */
pl-72padding-left: 18rem; /* 288px */
p-80padding: 20rem; /* 320px */
px-80padding-left: 20rem; /* 320px */ padding-right: 20rem; /* 320px */
py-80padding-top: 20rem; /* 320px */ padding-bottom: 20rem; /* 320px */
pt-80padding-top: 20rem; /* 320px */
pr-80padding-right: 20rem; /* 320px */
pb-80padding-bottom: 20rem; /* 320px */
pl-80padding-left: 20rem; /* 320px */
p-96padding: 24rem; /* 384px */
px-96padding-left: 24rem; /* 384px */ padding-right: 24rem; /* 384px */
py-96padding-top: 24rem; /* 384px */ padding-bottom: 24rem; /* 384px */
pt-96padding-top: 24rem; /* 384px */
pr-96padding-right: 24rem; /* 384px */
pb-96padding-bottom: 24rem; /* 384px */
pl-96padding-left: 24rem; /* 384px */

Basic usage

Add padding to a single side

Control the padding on one side of an element using the p{t|r|b|l}-{size} utilities.

For example, pt-6 would add 1.5rem of padding to the top of an element, pr-4 would add 1rem of padding to the right of an element, pb-8 would add 2rem of padding to the bottom of an element, and pl-2 would add 0.5rem of padding to the left of an element.

pt-6
pr-4
pb-8
pl-2
<div class="pt-6 ...">pt-6</div>
<div class="pr-4 ...">pr-4</div>
<div class="pb-8 ...">pb-8</div>
<div class="pl-2 ...">pl-2</div>

Add horizontal padding

Control the horizontal padding of an element using the px-{size} utilities.

px-8
<div class="px-8 ...">px-8</div>

Add vertical padding

Control the vertical padding of an element using the py-{size} utilities.

py-8
<div class="py-8 ...">py-8</div>

Add padding to all sides

Control the padding on all sides of an element using the p-{size} utilities.

p-8
<div class="p-8 ...">p-8</div>

Applying conditionally

Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:py-8 to only apply the py-8 utility on hover.

<div class="py-4 hover:py-8">
  <!-- ... -->
</div>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:py-8 to apply the py-8 utility at only medium screen sizes and above.

<div class="py-4 md:py-8">
  <!-- ... -->
</div>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.


Using custom values

Customizing your theme

By default, Tailwind’s padding scale uses the default spacing scale. You can customize your spacing scale by editing theme.spacing or theme.extend.spacing in your tailwind.config.js file.

tailwind.config.js
module.exports = {
  theme: {
    extend: {
      spacing: {
        '5px': '5px',
      }
    }
  }
}

Alternatively, you can customize just the padding scale by editing theme.padding or theme.extend.padding in your tailwind.config.js file.

tailwind.config.js
module.exports = {
  theme: {
    extend: {
      padding: {
        '5px': '5px',
      }
    }
  }
}

Learn more about customizing the default theme in the theme customization documentation.

Arbitrary values

If you need to use a one-off padding value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.

<div class="p-[5px]">
  <!-- ... -->
</div>

Learn more about arbitrary value support in the arbitrary values documentation.