CSS Border Generator
Build a border for each edge of a box. Adjust widths, styles, colors and opacity, compare the native preview, then copy CSS for your page.
How to build a border
- Edit Top, Right, Bottom and Left independently. For a uniform border, set Top first and select Apply top to all; this copies its current settings once rather than linking later edits.
- Check the preview and try a light, dark or checkerboard backdrop to inspect transparency. Its square corners, fill, padding, size and fit scale are preview context and are not part of the copied CSS.
- Complete any invalid fields before copying. Copy the five displayed declarations into your rule, after any earlier border reset. If clipboard access is unavailable, select the CSS field and copy it manually.
Understanding the generated border
Every side has its own width in CSS pixels, style, RGB color and opacity. Widths range from 0 to 64 with up to three decimal places. A dot or comma is a decimal separator, never a thousands separator; the output always uses a CSS decimal dot.
The editor offers none, hidden, dotted, dashed, solid, double, groove, ridge, inset and outset. The last four produce shaded effects using browser rendering. Very thin double borders remain valid even when two separate lines are difficult to see.
None and hidden draw no border on the ordinary preview box, and their border widths resolve to zero. Your entered widths and colors stay in the CSS so changing the style restores them. A zero-width edge also draws nothing; a transparent solid edge still takes up space.
Opaque colors use six-digit hex. Lower opacity uses rgba with the same RGB channels and an alpha value from zero to less than one. For example, #ABCD09 at 7% becomes rgba(171, 205, 9, 0.07); zero opacity keeps the color's channels rather than removing the border.
The first declaration removes existing border images. Four side declarations then set all physical edges. The output leaves radius, box sizing, padding, background and dimensions alone. Later or more specific rules can override it; use the Border Radius tool separately for rounded corners.
Border examples
For a uniform frame, use 4px solid #2563EB at full opacity on every side. The preview has a 160 by 80 content area and 10px padding, so its unscaled outer layout is 188 by 108 CSS pixels. Those layout settings are not exported.
For an asymmetric frame, try top 4px solid #123456, right 2px dashed #ABCDEF, bottom 6px double #804020 and left 8px ridge #408060. With the same preview context its integer outer layout is 190 by 110 CSS pixels; each side keeps its own appearance.
For a left accent, apply a 0px solid border to all sides, then change Left to 6px and a chosen color. The other sides remain independently editable. No hidden linked mode changes them when you adjust Left later.
To compare invisible borders, set Top to 9px none and Bottom to 6px solid with zero opacity. Top uses no border space in this ordinary box; Bottom still reserves 6px. The checkerboard can help show where the transparent edge sits.
Scope and rendering differences
This is a bounded editor, not a parser for arbitrary CSS. It accepts pixel widths, six-digit RGB hex and integer opacity. Relative units, width keywords, named colors, currentColor, variables and pasted declaration blocks are outside its input grammar.
Dash spacing, double-line division, shaded styles, mixed-style corners and fractional-pixel painting can vary between browsers. The preview uses native CSS; it does not promise identical physical pixels on every display.
Top, Right, Bottom and Left are physical sides. This editor does not author logical borders, outline or image/gradient borders. Its ordinary-box preview does not reproduce collapsed-table conflict rules, where hidden and none differ.
The five declarations intentionally remove image borders but do not set corner radius or box layout. The receiving page can therefore look different when its surrounding styles differ. Border color and this preview alone do not establish accessibility of a complete interface.
Editing and clipboard privacy
Border settings are processed in this page without uploading them for CSS generation. The tool does not read your clipboard, load a user-supplied image or save settings in a URL or persistent store. Copy attempts to write only the current valid declarations when you request it.
CSS border questions
Sources
These references describe the CSS used by this ordinary-box editor.
- W3Cw3.orgCSS Backgrounds and Borders Level 3Border widths, styles, colors and rendering.
- MDNdeveloper.mozilla.orgMDN: borderBorder shorthand and its reset of border images.
- W3Cw3.orgCSS Sizing Level 3Box sizing and the preview’s content-box context.
- W3Cw3.orgCSS 2.2 table border conflictsThe different roles of hidden and none in collapsed tables.
The preview is an ordinary box, not a collapsed table.
Related tools
CSS Filter Generator
Order and repeat CSS effects, compare a specimen and copy the exact filter declaration.
Open tool — CSS Filter GeneratorFluid Font Size Calculator
Create root-relative CSS from viewport endpoints and inspect the copied size model.
Open tool — Fluid Font Size CalculatorCSS Button Generator
Style native button states, inspect keyboard focus and copy HTML and CSS.
Open tool — CSS Button GeneratorCSS Background Pattern Generator
Create editable stripes, grids, dots and checkerboards. Preview colors and transparency locally, then copy the current CSS declarations.
Open tool — CSS Background Pattern GeneratorCSS Clip Path Generator
Edit polygon points and basic shapes, preview the clipping and copy CSS.
Open tool — CSS Clip Path GeneratorCSS Border Radius Generator
Edit eight corner radii, preview a box and copy CSS in pixels or percentages.
Open tool — CSS Border Radius GeneratorCSS Grid Generator
Build a bounded CSS Grid example with editable tracks, placement and named areas. Preview it, copy CSS or HTML and download the same standalone example.
Open tool — CSS Grid GeneratorCSS Flexbox Generator
Build a Flexbox example with container and item controls, explicit layout axes, matching CSS and HTML, and a local complete-example download.
Open tool — CSS Flexbox GeneratorCSS Text Shadow Generator
Build ordered text shadows, preview plain text and copy exact CSS.
Open tool — CSS Text Shadow GeneratorCSS Transform Generator
Compose repeatable 2D CSS transforms, edit px or percentage translation and origin, inspect a reference box and copy the exact current declarations.
Open tool — CSS Transform GeneratorCSS Cubic Bezier Generator
Edit CSS cubic-bezier curves with coordinates, visual handles and presets. Inspect overshoot, run a deliberate comparison with linear motion, and copy easing CSS.
Open tool — CSS Cubic Bezier GeneratorCSS Box Shadow Generator
Create ordered CSS box-shadow layers with a live preview and copyable code.
Open tool — CSS Box Shadow GeneratorHTML to Markdown
Convert pasted or local HTML into Markdown, review conversion notes, and copy or download the result.
Open tool — HTML to MarkdownJavaScript Regex Tester
Test a JavaScript pattern locally and inspect matches, captures, and UTF-16 positions.
Open tool — JavaScript Regex TesterMarkdown to HTML
Convert a Markdown draft to an HTML fragment, inspect the source and inert preview, then copy or download it.
Open tool — Markdown to HTMLCSS Gradient Generator
Create linear or radial CSS gradients with editable colors, opacity and stops.
Open tool — CSS Gradient GeneratorColor Converter
Convert supported sRGB HEX, RGB and HSL literals with alpha, explicit precision and current code Copy.
Open tool — Color ConverterHTML Entity Encoder/Decoder
Encode or decode literal HTML references with explicit context, Unicode options and LF output, without parsing or rendering markup.
Open tool — HTML Entity Encoder/DecoderMarkdown Table Generator
Edit a small literal-text table, set alignment and copy GFM Markdown or import tab-separated text.
Open tool — Markdown Table GeneratorHTML Table Generator
Build a rectangular table with captions and headers, then copy HTML and CSS.
Open tool — HTML Table GeneratorQuery String Parser & Builder
Edit ordered URL parameters, retain repeated names and copy a normalized query or HTTP(S) URL.
Open tool — Query String Parser & BuilderURL Encoder & Decoder
Convert a UTF-8 URL component or form value with explicit space and plus rules, then copy or download the result.
Open tool — URL Encoder & DecoderColor Contrast Checker
Compare foreground and background colors, adjust opacity and check WCAG numerical contrast thresholds for text and essential interface details.
Open tool — Color Contrast CheckerBase64 Encoder & Decoder
Encode UTF-8 text as standard or URL-safe Base64, or decode either format with clear errors and complete text output.
Open tool — Base64 Encoder & Decoder