Apple iPhone 5: CSS viewport of 320 × 568 px, resolution and responsive test

Apple · iOS 14.0 · Smartphone · 2012

Released in 2012, Apple iPhone 5 features a CSS viewport of 320 x 568 pixels. Here are all its display characteristics and how to check the responsive rendering of your site on this model.

Test your site on Apple iPhone 5 directly in your browser, without buying the device.

  • Apple iPhone 5 available in the device list
  • Real viewport, User-Agent, and touch events
  • Also works on localhost and in pre-production
  • Exportable screenshots and videos
Install the extension

4.9/5 based on 5,100 reviews · 1,000,000 users · free

Why test your site on Apple iPhone 5?

Narrow viewport

With only 320 pixels wide, Apple iPhone 5 is among the most restrictive formats. This is where tables overflow, titles break poorly, and buttons become too small.

Older hardware

The hardware of Apple iPhone 5 dates from 2012. Its processor makes costly animations, heavy scripts, and display times visible that recent devices mask.

2x density

With a density of 2x, Apple iPhone 5 provides a useful benchmark to ensure your images remain sharp without serving unnecessarily large files.

CSS viewport resolution of Apple iPhone 5

This resolution is what your stylesheet actually manipulates. It determines the applied breakpoint, the number of displayed columns, and the size of your images.

  • 320 pixels in width
  • 568 pixels in height

The height remains indicative: Safari, Chrome, and other mobile browsers reduce the visible area with their address bar, which folds on scroll.

Be cautious when analyzing your statistics: some tools only report the manufacturer resolution, never the CSS viewport presented here.

Pixel density of Apple iPhone 5

2

The device pixel ratio of Apple iPhone 5 is 2.

Each CSS pixel is thus rendered by 2 physical pixels, making any image provided in simple resolution immediately visible.

Manufacturer resolution of Apple iPhone 5

This is the number of physical pixels on the screen, as announced by the manufacturer. Useful for preparing your image exports, useless for your media queries.

  • 640 pixels in width
  • 1136 pixels in height
  • 16:9 Screen ratio

326 pixels per inch (ppi) · 4 inches diagonal, or 10.2 cm

User-Agent of Apple iPhone 5

This string is what the browser of Apple iPhone 5 sends. It is useful for your automated tests, reading your server logs, and server-side detection.

User-Agent

User-Agent string used by Apple iPhone 5, useful for your automated tests and logs.

Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1

Media queries and code snippets for Apple iPhone 5

These snippets are generated from the exact characteristics of Apple iPhone 5. Copy them directly into your stylesheet or configuration.

CSS media query

Targets screens whose width matches that of Apple iPhone 5 and models of the same format.

@media only screen and (min-width: 320px) and (max-width: 567px) {
  /* Apple iPhone 5 */
}

Density media query

Serves high-resolution images to screens of at least 2x.

@media only screen and (-webkit-min-device-pixel-ratio: 2),
       only screen and (min-resolution: 192dpi) {
  /* High-density images and icons */
}

Tailwind configuration

Adds a named breakpoint at the exact width of Apple iPhone 5.

// tailwind.config.js
module.exports = {
  theme: {
    screens: {
      'apple-iphone-5': '320px'
    }
  }
}

JavaScript detection

Detects format and density client-side.

const isDeviceWidth = window.matchMedia('(min-width: 320px)').matches;
const isHighDensity = window.devicePixelRatio >= 2;

Meta viewport tag

Essential for Apple iPhone 5 to use its CSS viewport and not a simulated width of 980 pixels.

<meta name="viewport" content="width=device-width, initial-scale=1">

Free Apple iPhone 5 simulator

Mobile FIRST includes Apple iPhone 5: your page displays in a viewport of 320 x 568 pixels, with the model's User-Agent, touch events, and scrolling behavior of a real mobile.

This is where the difference with Chrome DevTools' responsive mode is seen: DevTools resizes a window, the extension replicates the device's browser and allows exporting shareable screenshots and videos.

  1. 01 Install the extension Add Mobile FIRST to Chrome, Firefox, or Edge. Installation is free and requires no account.
  2. 02 Open the page to test Go to the URL to check, including a local address like localhost:3000.
  3. 03 Choose Apple iPhone 5 Select Apple iPhone 5 from the list of devices. The viewport switches to 320 x 568 pixels, and the mobile User-Agent is applied.
  4. 04 Check rendering Scroll, change orientation, test your forms, then capture an image or video to share.

Models sharing the format of Apple iPhone 5

These 3 devices share exactly the viewport of 320 x 568 pixels and the 2x density of Apple iPhone 5. Their CSS rendering is therefore exactly the same: what you validate on one is valid on all others.

Comparison with similar models

The neighboring formats of Apple iPhone 5 are the ones to test right after, as they reveal poorly placed breakpoints.

Comparison of resolutions of Apple iPhone 5 and nearby models
Model CSS Viewport Pixel density Manufacturer resolution
Apple iPhone 5 320 x 568 2x 640 x 1136
Apple iPhone SE 320 x 568 2x 640 x 1136
Apple iPhone 5c 320 x 568 2x 640 x 1136
Apple iPhone 5s 320 x 568 2x 640 x 1136
Samsung Galaxy J5 360 x 640 2x 720 x 1280
Samsung Galaxy J7 360 x 640 2x 720 x 1280
Samsung Galaxy J5 Prime 360 x 640 2x 720 x 1280

Frequently asked questions about Apple iPhone 5

What is the CSS viewport resolution of Apple iPhone 5?

The CSS viewport of Apple iPhone 5 measures 320 pixels wide and 568 pixels high. This is the width to use for defining your media queries, not the manufacturer's resolution.

What is the pixel density of Apple iPhone 5?

The device pixel ratio of Apple iPhone 5 is 2. Each CSS pixel is thus displayed by 2 physical pixels, requiring you to provide your images in 2x to keep them sharp.

What is the screen resolution of Apple iPhone 5?

The panel of Apple iPhone 5 displays 640 x 1136 physical pixels. This is the value reported by most analytics tools, while your CSS works on a viewport of 320 x 568 pixels.

What is the User-Agent of Apple iPhone 5?

The User-Agent of Apple iPhone 5 is: Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1

Which devices have the same viewport as Apple iPhone 5?

3 other models share exactly the viewport of 320 x 568 pixels and the 2x density of Apple iPhone 5: Apple iPhone 5c, Apple iPhone 5s, Apple iPhone SE. A rendering validated on one is valid on all others.

How to test my site on Apple iPhone 5 without the device?

Install the Mobile FIRST extension on Chrome, Firefox, or Edge, then select Apple iPhone 5. Your page displays in a viewport of 320 x 568 pixels with the corresponding mobile User-Agent, in two clicks and for free.

What is the difference with Chrome DevTools' responsive mode?

DevTools resizes the window and applies partial emulation. Mobile FIRST additionally applies the User-Agent of Apple iPhone 5, touch events, scroll behavior, and the actual appearance of the device, and allows capturing directly usable images and videos.

Can I test a localhost address on Apple iPhone 5?

Yes. The extension works on any URL open in your browser, including localhost:3000, 127.0.0.1, or a password-protected pre-production environment.

Do you need to buy a Apple iPhone 5 to test your site?

No. The simulation covers the vast majority of development needs at no cost. A final test on a real device is still recommended before critical production deployment, but it's no longer necessary for each iteration.

Which media query to use to target Apple iPhone 5?

A media query on the exact width targets Apple iPhone 5: @media only screen and (min-width: 320px). Combine it with the pixel density to precisely target this model and those sharing its format.

Test your site on 77 devices, directly in your browser

Without buying a single phone, without creating an account.

  • 77 devices available upon installation
  • Real viewport, User-Agent, and touch events
  • Also works on localhost and in pre-production
  • Exportable screenshots and videos
Install the extension

Free installation in seconds · computer only