Writing CSS border declarations from memory means guessing widths and flipping between your editor and browser repeatedly.
Loading Border Builder…
Live preview updates on every value change
Generates both shorthand and individual border properties
Full control over width, style, and color per side
Shows browser default border values for reference
Drop the Border Builder into any page — blog post, product docs, intranet, school portal — with a single line of HTML. Your visitors get the full tool, processed entirely in their browser. No backend, no uploads, no signup.
Embed code
<iframe
src="https://www.fixtools.io/css-tool/border-builder?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="Border Builder by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
The CSS border shorthand property sets border-width, border-style, and border-color in a single declaration. The syntax is border: width style color, for example border: 2px solid #333. The order matters: browsers parse the three values by type rather than position, so border: solid 2px #333 also works, but the conventional order is width, style, color to match the longhand property names. If you omit any value, the browser applies its default: medium for width, none for style, and currentColor for color. Because border-style defaults to none, a declaration like border: 2px #333 produces no visible border at all, which is a frequent source of confusion.
Individual properties give you more control when you need different values per side. border-width accepts one to four values following the same top, right, bottom, left shorthand pattern used by margin and padding. A single value applies to all four sides; two values set top/bottom and left/right; three values set top, left/right, and bottom; four values set each side independently. border-style and border-color follow the same pattern. When you combine shorthand with individual overrides, place the individual property after the shorthand in your CSS so it takes precedence: border: 1px solid #ccc followed by border-bottom: 2px solid #000 produces a heavier bottom border.
Browser defaults vary slightly and affect how reset stylesheets interact with borders. Most elements have border: none or no border rules at all by default, but form elements like input, select, and textarea often have browser-specific border styles that differ between Chrome, Firefox, and Safari. Chrome renders input borders at 1px inset in some contexts; Firefox applies a similar inset style. Normalizing these with border: 1px solid #ccc or including a CSS reset ensures consistent appearance. When debugging a missing border, check whether border-style is set: it is the most commonly forgotten value that prevents any border from appearing.
Box-sizing has an outsized influence on how border declarations actually behave in layout, and it deserves explicit thought before you commit to widths in a design system. With the default content-box model, a border adds to the declared width and height: a 200px button with border: 2px solid #333 occupies 204px horizontally and 204px vertically because the border is painted outside the content box. Adding or removing a border shifts the element's outer size, which can cause neighbors to reflow and produces visible jitter on hover or focus states that change border thickness. The standard fix is to set box-sizing: border-box globally so the border subtracts from the content area instead. A 200px border-box button stays 200px regardless of border width. Most modern resets apply this universally; if you inherit a codebase without it, expect to find ad-hoc width adjustments scattered through the styles to compensate.
Select a border style first, such as solid or dashed, then set the width in pixels and pick a color. The tool generates the border shorthand automatically. Switch to individual properties if you need different values per side.
Step-by-step guide to css border generator:
Choose a border style
Select solid, dashed, dotted, double, or another style from the style picker. Border-style must be set for any border to appear, so start here before adjusting other values.
Set border width
Use the width slider or input to set the border thickness in pixels. Typical values range from 1px for subtle borders to 4px for prominent ones.
Pick a border color
Open the color picker and choose a border color. You can also type a hex value or use rgba() for semi-transparent borders.
Copy the generated CSS
Click Copy CSS to copy the border shorthand or individual property declarations. Paste into your stylesheet and verify in your browser.
Common situations where this approach makes a real difference:
Adding a consistent border to all input fields
Form inputs have inconsistent native borders across browsers. Setting border: 1px solid #d1d5db normalizes them to a clean, consistent appearance. You can then override on focus with border-color: #6366f1 to provide a visual indicator. Using the shorthand ensures all three sub-properties are set explicitly, preventing browser defaults from leaking through in any context.
Creating a bordered card component
Card components often use a light border combined with border-radius and a subtle box-shadow. A border of 1px solid #e5e7eb paired with border-radius: 8px gives a contained appearance. The border-generator helps you preview the exact color and width before committing, and you can adjust the color to match your design token palette without switching back to the browser repeatedly.
Debugging a border that is not appearing
A missing border is almost always caused by border-style defaulting to none. The tool shows all three required values together, making it easy to spot if you forgot to set a style. You can also confirm that border-width is greater than 0 and border-color is not transparent, which are the two other common causes of invisible borders.
Building a table with selective borders
HTML tables often need borders only on certain sides: a bottom border on th cells for header separation, no left or right borders. Using individual properties like border-bottom: 1px solid #e5e7eb on th and td, combined with border-collapse: collapse on the table element, produces clean table styling. The generator lets you preview each side independently before writing the final CSS.
Get better results with these expert suggestions:
Use currentColor to inherit text color automatically
Setting border-color: currentColor makes the border match the element's text color without hardcoding a value. This means the border updates automatically if you change the color property, which is useful for themed components and dark mode implementations where text and border colors should stay coordinated.
Combine border with box-sizing: border-box
By default, border adds to an element's width and height (content-box model). Switching to box-sizing: border-box makes the border subtract from the content area instead, so a 200px element with a 2px border stays 200px wide. This prevents layout shifts when adding or removing borders.
Transparent borders reserve space without showing
Setting border: 2px solid transparent allocates border space in the layout without visible lines. This is useful for hover states: you can change transparent to a color on hover without the element shifting size, because the border space was already reserved in the initial state.
Shorthand resets properties you do not specify
Writing border: none resets all four sides and all three sub-properties to their defaults, which is more thorough than border-style: none alone. Use the shorthand when you want to completely remove a border, and use individual properties when you only want to modify one aspect of an existing border.
Always set border-style explicitly
Border-style defaults to none, which means no border appears even if you set width and color. Always include border-style: solid (or another value) or use the shorthand to avoid invisible borders that are hard to debug.
Use border shorthand then override individual sides
Set a base border with the shorthand, then override specific sides with border-top or border-left below it in your CSS. This keeps declarations concise while still allowing per-side customization without repeating all three values.
Check form inputs separately
Input, textarea, and select elements have browser-native border styles that differ across browsers. Target them explicitly in your CSS and test in Chrome, Firefox, and Safari to catch inconsistencies before production.
More use-case guides for the same tool:
Other tools you might find useful:
Open the full Border Builder — free, no account needed, works on any device.
Open Border Builder →Free · No account needed · Works on any device