Your SVG is 160 pixels wide, but the logo inside it looks much smaller than the surrounding navigation. Increasing the CSS width makes the layout awkward without fixing the apparent padding. Inspect the SVG’s viewBox before resizing the page around it.
The viewBox selects the internal coordinate rectangle that is mapped into the displayed SVG. If the drawing occupies only half that rectangle, it also occupies only part of the displayed image. CSS width scales the drawing and its empty frame together.
This walkthrough uses one small example to separate three problems: excess internal whitespace, an incorrect display ratio and clipped artwork. Keep a copy of the original file while you work.
Read the four numbers before editing them
A viewBox contains min-x min-y width height. The first two numbers locate the selected rectangle in the drawing’s coordinate system. The final two describe the rectangle’s dimensions, rather than its far-right and bottom coordinates.
For example, viewBox="100 50 200 100" selects a rectangle beginning at 100, 50, extending 200 units across and 100 units down. Its right edge is at 300 and its bottom edge is at 150.
Those are internal user units. The displayed image might be 160 CSS pixels wide without changing the path coordinates. MDN’s viewBox reference documents the attribute and its relationship to the viewport.
A useful first check is simply whether the width and height describe the intended frame. Do not replace every SVG with 0 0 100 100; that would select a different coordinate area and can crop or misalign the drawing.
A worked example: the drawing fills half the frame
This complete authored SVG contains a 200 × 100 mint rectangle inside a 400 × 200 frame:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 200">
<path d="M100 50H300V150H100Z" fill="#83e3b1" />
</svg>
The rectangle starts 100 units from the frame’s left edge and 50 from its top. It fills half the width and half the height. At a displayed width of 160 pixels, the colored rectangle is only 80 pixels wide.
Doubling the CSS width to 320 makes the rectangle 160 pixels wide, but it also makes the full frame 320 pixels wide. That can introduce unexpected spacing or push neighboring content aside.
If the intended deliverable is the rectangle without that padding, select its bounds as the frame:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="100 50 200 100">
<path d="M100 50H300V150H100Z" fill="#83e3b1" />
</svg>
The path data is unchanged. The corrected frame maps the drawing to the full display area. At 160 pixels wide, the colored rectangle is now 160 pixels wide and 80 pixels high.
This calculation is safe for this deliberately simple filled rectangle. A real logo may include strokes, shadows, transforms and intentional clear space, so use visible bounds and a working copy rather than applying these numbers blindly.
Find the bounds with the artwork visible
Open the SVG in a vector editor and inspect which objects belong in the final asset. Select the required artwork, then use the editor’s page or document framing controls to fit the page to the intended bounds.
Inkscape exposes document sizing through its document properties; the workspace guide explains the page model. Control placement can vary by version, so work from the drawing and the page boundary rather than a memorized sequence of screenshots.
Check for hidden or stray objects before fitting the frame. A tiny shape far from the main logo can expand the selection’s overall bounds and leave the visible mark looking small. Remove only objects you have identified as unwanted.
Leave approved clear space when it is part of the asset specification. A tightly cropped export is not inherently better if the design system deliberately uses a consistent square frame for a family of icons.
After adjusting the frame, save a new file and place it in the actual layout. Confirm that its alignment improves without clipping any visible detail.
Distinguish framing from aspect-ratio padding
An SVG’s internal frame and its displayed container can have different proportions. A 2:1 viewBox placed into a square viewport has to resolve that mismatch. With the usual aspect-ratio-preserving behavior, unused space can appear around the fitted drawing.
That space is different from empty coordinates already inside the viewBox. Tightening the internal frame does not automatically make a square CSS box match a wide wordmark.
Use display dimensions matching the asset’s intended ratio when possible:
<img src="/logo.svg" alt="Example brand" width="160" height="80" />
This example assumes a 2:1 asset. Choose your own dimensions from the corrected frame, then inspect any surrounding CSS that sets width, height or object fitting.
When you control the SVG source, these values make the tradeoff explicit:
| Value | A wide drawing in a square viewport |
|---|---|
xMidYMid meet (the default) |
Keeps the proportions and fits the whole viewBox, leaving unused space |
xMidYMid slice |
Keeps the proportions and covers the viewport; some content extends beyond it and can be clipped |
none |
Allows different horizontal and vertical scales, stretching the drawing to fit |
The preserveAspectRatio reference defines these choices. For a logo, matching the viewport to the approved proportions is usually safer than cropping or stretching it to fill an arbitrary square.
Why tightening a viewBox can clip the edge
A path’s centerline and its visible painted bounds are not always the same. A stroke extends around the path; a shadow or another effect can extend beyond the basic shape. A frame fitted to coordinates without considering that paint can cut off the result.
For a concrete example, add a centered 10-unit stroke to the simple rectangle above. Its centerline runs from x=100 to 300 and y=50 to 150, but the stroke reaches 5 units farther on each side. A frame of 95 45 210 110 includes that rectangle’s painted bounds. The tighter 100 50 200 100 frame cuts through its stroke when the image is clipped to the viewport.
That calculation applies to this axis-aligned rectangle without other effects or transforms. Acute joins, shadows and transformed objects need their own visible-bounds check. Inspect all four edges after a crop and keep deliberate space for the paint that belongs in the file.
Also check clipping paths and masks. A larger viewBox cannot reveal content that another part of the document intentionally clips. Changing the outer frame may be the wrong repair when a clip or mask defines the missing region.
If the file behaves differently when used as an image than when opened in an editor, test the actual delivered SVG in the target context. Do not approve the export solely from the editor’s canvas, which may show artwork outside the saved page.
Trace source padding back to the original raster
When a logo is converted from a PNG or JPG, its source canvas can carry substantial empty space. Decide whether that space is intentional before tracing. Cropping a working source copy can make the preview easier to inspect.
Do not crop through thin strokes or an intentional border. A small gap around the logo may be appropriate for the destination. The preparation checklist helps separate irrelevant surroundings from useful clear space.
If you already have a good SVG, fixing its frame is usually more direct than exporting it to PNG and tracing it again. Repeated conversion introduces a new reconstruction step without addressing the coordinate problem.
For a new trace, preview the logo, inspect the output and then decide whether its frame needs adjustment. Keep the original raster and untouched conversion while making the approved version.
Keep coordinates separate from resolution
Changing a viewBox changes which coordinate rectangle maps into the viewport. It does not add raster detail or improve an inaccurate trace. If the SVG contains a low-resolution embedded picture, a tighter frame can make that picture fill more of the display while leaving its sampling limit unchanged.
Use framing to solve placement and whitespace. Use source selection, tracing or manual geometry edits to solve the shape itself. Keeping those jobs separate makes the effect of each change easier to judge.
A quick diagnosis before changing the layout
If the mark is small but the image box is the expected size, inspect internal whitespace and stray objects. If the asset is tightly framed but its container has another ratio, inspect display dimensions and fitting. If part of the drawing disappears, inspect painted bounds, clips and masks.
Reopen the final export at the actual display size and on the intended background. Check proportion, edge visibility and alignment with nearby content. Those observations tell you whether the frame now serves the job.
For background problems, use the transparency guide. For uncertainty about the SVG’s contents, use the file inspection walkthrough. Keep the repair focused on the symptom: a coordinate frame, a painted backdrop and an embedded bitmap need different changes.
