---
title: "Add Border to Image Online – Photo Frame Tool | CompressFly"
description: "Add white, black, or custom HEX borders to JPG, PNG, WebP, AVIF, or BMP in your browser. Outside or inside placement, per-side widths. Free, no uploads."
canonical_url: "https://compressfly.com/edit-image/add-border-to-image"
meta:
  "og:description": "Add white, black, or custom HEX borders to JPG, PNG, WebP, AVIF, or BMP in your browser. Outside or inside placement, per-side widths. Free, no uploads."
  "og:image": "https://compressfly.com/img/en/social/edit-image/add-border-to-image.png"
  "og:image:alt": "Add Border to Image Online – Photo Frame Tool | CompressFly"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Add Border to Image Online – Photo Frame Tool | CompressFly"
  "twitter:description": "Add white, black, or custom HEX borders to JPG, PNG, WebP, AVIF, or BMP in your browser. Outside or inside placement, per-side widths. Free, no uploads."
  "twitter:image": "https://compressfly.com/img/en/social/edit-image/add-border-to-image.png"
  "twitter:image:alt": "Add Border to Image Online – Photo Frame Tool | CompressFly"
  "twitter:title": "Add Border to Image Online – Photo Frame Tool | CompressFly"
---

> Index of every page on this site: [llms.txt](https://compressfly.com/llms.txt)

# Add Border to Image Online

Add an inside or outside border to your image with a custom color and pixel widths for each side. Processing stays in your browser with no uploads.

## How to Add a Border to an Image in 3 Easy Steps

Frame photos, UI screenshots, and digital artwork with pixel-accurate borders—100% locally in your browser:

1. **Select Your Image** — Choose a .jpg, .jpeg, .png, .webp, .avif, or .bmp file from your device, or drag and drop it directly into the browser workspace.
2. **Configure Placement, Pixel Width & Color** — Select Outside Image or Inside Image, keep Same on all sides enabled for a uniform frame (or turn it off to enter separate Top, Right, Bottom, and Left pixel widths), and pick a swatch, color picker shade, or 6-digit #HEX code.
3. **Preview Dimensions and Download** — Compare the original and framed preview, verify the updated output pixel dimensions, select PNG, JPG, or WebP, and click "Download Image."

## How Does the CompressFly Image Border Tool Work?

CompressFly draws solid-color borders on **JPG/JPEG, PNG, WebP, AVIF, and BMP** images your browser can open. **Outside Image** adds pixels around the photo so the entire image stays visible. **Inside Image** draws over the edges and keeps the original width and height.

Border widths can be the same on all four sides or set separately, as with a wider bottom edge on a Polaroid-style frame. Your browser renders the border and exports a static **PNG, JPG, or WebP** image locally, even if the input is animated.

### What "in your browser" means

- No image file is uploaded to an external server
- Pixel-accurate canvas expansion and inset drawing run locally
- PNG, JPG, or WebP downloads are generated by your browser

## Outside Border vs. Inside Border: How Output Dimensions Change

Choose your border placement and side-width mode based on whether you want to expand the canvas outward or maintain fixed pixel dimensions:

| Border Mode | Output Width & Height Formula | Example (1000 × 800 px Source Image) | Visual Result & Best Use Case |
| --- | --- | --- | --- |
| **Outside Image (Uniform Sides)** | `(Width + 2 × Border) × (Height + 2 × Border)` | `20 px` on all 4 sides → **`1040 × 840 px`** | Surrounds the image without covering a single edge pixel. Ideal for photo mats, gallery frames, and screenshot outlines. |
| **Outside Image (Separate Sides)** | `(Width + Left + Right) × (Height + Top + Bottom)` | Top/Left/Right `40 px`, Bottom `120 px` → **`1080 × 960 px`** | Creates Polaroid-style bottom margins, letterbox bars (Top/Bottom only), or pillarbox side bars (Left/Right only). |
| **Inside Image (Uniform or Separate)** | **Unchanged** (`Width × Height` stays identical to source) | `20 px` inside border → **`1000 × 800 px`** | Draws the frame inward over the outer edges. Ideal when a website grid, ad banner, or avatar slot requires exact pixel dimensions. Very wide borders can cover most or all of the image. |

## Popular Border Styles & Pixel Recipes

Use these practical border settings to prepare photography, documentation screenshots, and social media visuals:

### Crisp Screenshot & UI Outlines (1px – 4px)

White-background app screenshots disappear against white blog posts, Notion pages, and GitHub READMEs. Add a 1 px to 4 px light gray (#E5E7EB) or dark Outside border and export as PNG for clean separation.

### White Gallery Mats & Portfolio Frames (20px – 100px)

Give high-resolution JPEGs a classic gallery print look with a 40–80 px outside border in white (#FFFFFF) or black (#000000).

### Polaroid & Bottom-Weighted Frames

Turn off "Same on all sides," choose Outside Image in white (#FFFFFF), and set Top, Left, and Right to 40 px with Bottom set to 120 px–160 px to create an instant film frame.

### Fixed-Dimension Ad & Card Borders (Inside Image)

When an e-commerce product card (1000 × 1000 px) or display banner must stay at its exact pixel size, select Inside Image to add a 2 px–10 px brand-colored #HEX frame without enlarging the canvas.

## Precision Controls in the Image Border Workspace

Customize placement, per-side thickness, exact brand colors, and export formats in one place:

### Outside or Inside Canvas Placement

Toggle between Outside Image (expands canvas to preserve 100% of your photo) and Inside Image (overlays the border on existing edges to lock original pixel dimensions).

### Uniform or Per-Side Pixel Widths

Set a uniform border or enter separate Top, Right, Bottom, and Left widths from 0 to 2000 px. The uniform-width slider covers 0–300 px; enter larger values in a number field. Decimal values are rounded to whole pixels.

### Swatches, Color Picker & 6-Digit #HEX

Choose white, dark gray (#111827), or accent swatches, use the color picker, or enter a 6-digit HEX code. For pure black, enter #000000. Border colors are opaque.

### Live Dimension Preview & PNG / JPG / WebP Export

Compare the original and bordered views, check the exact output width and height in pixels, and save a static PNG, JPG, or WebP image. PNG uses lossless encoding for the rendered image; JPG fills transparent areas with white.

## Related Image Framing, Cropping & Social Media Tools

- [Crop Image (Custom Box & Aspect Ratios)](https://compressfly.com/edit-image/crop-image)
- [Resize Image (By Pixels or Percentage)](https://compressfly.com/edit-image/resize-image)
- [Rotate Image (−180° to 180°)](https://compressfly.com/edit-image/rotate-image)
- [Flip Image (Horizontal & Vertical Mirror)](https://compressfly.com/edit-image/flip-image)
- [Grayscale & Black-and-White Image](https://compressfly.com/edit-image/grayscale-image)
- [Social Media Image Resizer (Fit Entire Image)](https://compressfly.com/edit-image/social-media-image-resizer)
- [Resize Image for Instagram (4:5, 1:1 & Story)](https://compressfly.com/edit-image/resize-image-for-instagram)
- [Instagram Profile Picture Resizer (1080×1080)](https://compressfly.com/edit-image/instagram-profile-picture-resizer)
- [Facebook Cover Photo Resizer (851×315)](https://compressfly.com/edit-image/facebook-cover-photo-resizer)
- [YouTube Thumbnail Maker (3840×2160)](https://compressfly.com/edit-image/youtube-thumbnail-maker)
- [Remove Image Background](https://compressfly.com/edit-image/remove-background)
- [Change Image DPI (300 / 600 DPI)](https://compressfly.com/edit-image/change-image-dpi)

## Image Border Tool FAQ

### How do I add a border to an image online?

Select or drag and drop a JPG/JPEG, PNG, WebP, AVIF, or BMP image your browser can open into the workspace. Choose "Outside Image" or "Inside Image," set a uniform pixel width or turn off "Same on all sides" to enter separate Top, Right, Bottom, and Left widths, and pick your border color. Preview the framed image and output dimensions, choose PNG, JPG, or WebP, and click "Download Image."

### What is the difference between an Outside border and an Inside border?

Choosing "Outside Image" expands the canvas around your photo so the border never covers any part of your image—for example, a 1000 × 800 px photo with a 20 px outside border on all four sides becomes 1040 × 840 px. Choosing "Inside Image" keeps the exact source dimensions (1000 × 800 px) and draws the 20 px border inward over the outer edges of the image. Very wide Inside borders can cover most or all of the image.

### How can I create a Polaroid frame or set a different border width on each side?

Turn off "Same on all sides" to set Top, Right, Bottom, and Left separately. For a white Polaroid frame, select "Outside Image," set Top, Left, and Right to 40 px, and Bottom to 120–160 px. Each side accepts 0–2000 px; decimals are rounded to whole pixels. The uniform-width slider covers 0–300 px; enter larger values in a number field. Set a side to 0 px to leave it unframed.

### Can I add a white, black, or exact HEX color border to a photo?

Yes. The preset swatches include white (#FFFFFF), dark gray (#111827), and accent colors. For pure black, enter #000000 in the HEX field. You can also use the color picker or enter any 6-digit HEX code to match your brand palette or website background. Border colors are opaque.

### Which input and output image formats are supported?

Input formats are JPG/JPEG, PNG, WebP, AVIF, and BMP, subject to your browser's support. Results are static PNG, JPG, or WebP images; animation is not retained. PNG uses lossless encoding for the rendered image, but source metadata and color profiles are not guaranteed to be retained. JPG turns transparent areas white; PNG and WebP can retain transparency in areas not covered by the opaque border.

### How do I add white borders to make a photo fit Instagram or social media without cropping?

Turn off "Same on all sides" here to add custom left/right or top/bottom borders. For a preset canvas, open [Resize Image for Instagram](https://compressfly.com/edit-image/resize-image-for-instagram) or [Social Media Image Resizer](https://compressfly.com/edit-image/social-media-image-resizer), choose your target size, select "Fit Entire Image," and set a white background. This keeps the whole photo visible within the selected canvas. The default "Crop to Fill" mode can crop the photo instead of adding padding.

### Can I preview the bordered image and check the final pixel dimensions before downloading?

Yes. The workspace displays a live preview where you can switch between the original and bordered image and check the exact output width and height in pixels before clicking "Download Image."

### Are my images uploaded to a server, and is this border tool free?

No files are ever uploaded—all border rendering and format conversion happen 100% locally inside your web browser on your own computer or phone. The tool is completely free with no watermarks, no daily limits, and no account registration required.

## Sitemap

See the full [sitemap](https://compressfly.com/sitemap.md) for all pages.
